Awake may run before the Killable has done anything? I would try Start. Well, you can cache the Killable component itself in Awake, but I'd try to read it in Start or later. Anyway, CurrentHitPoints is an non-nullable integer so it can't be "no value". It could be zero if you called too early. What's in the Console?
I have damage from another script. That the Killable understood that he died transfer damage in Killable ("TakeDamage" Call this method to inflict X points of damage to a Killable) and then he get me LIVES -1. lol.
The only way that will happen is if you have changed a certain setting on the Killable. It's not the default. Open the "Despawn & Death Triggers" section and see if you have "HP Death Mode" set to something different than "Zero Hit Points". The 2nd and 3rd choice would make it die early.
If you have the default there, then turn on Log Events for the Killable and see if any hint is given in the Console when it dies.
Post by DarkTonic Dev on Apr 12, 2018 15:46:38 GMT
The first part looks like you want the game to end when you reach zero lives. That sort of functionality is already built in, you don't have to write code for it. On the World Variable, make sure "Triggers Game Over" is on and you specify the range (like 0-0). In fact that's the default for the Lives variable.
For the 2nd part, after or before GameOver doesn't matter, the code is the same to read a World Variable. var variable = WorldVariableTracker.GetWorldVariable("yourVarName"); variable.CurrentIntValue = 45; // or CurrentFloatValue for a float!
I copied that code from the online documentation, you probably should do a quick read so you can get quicker responses than waiting for me. Link below.