Property not being set in code or blueprints
I have just migrated my project to 4.8 (its not a critical project) but I have run into an unusual bug.
I have set my property in my header file as such:
and in my constructor in my source file I set is like so:
In order to give it a default value. However when I set up a log point directly after that it returns 0, telling me that it has not been set at all. It gives the same result in BeginPlay().
I also noticed that even if I use a hard coded 30 damage into the TakeDamage function like so:
The ReceiveAnyDamage event does not fire. Was this changed somehow for 4.8?
Checking variables in the constructor is perfectly fine - C++ would be pretty unusable if that would not be the case.
However "ExplosionDamage" is of type "float" and your UE_LOG prints out that float as an "int" because you are using "%d". So this will give you wrong output at least.
Why not just set a breakpoint and check what the Debugger tells you about that variable?
Also, just step into the TakeDamage() code and see what is happening. As you can see the damage may get modified by InternalTakePointDamage() or InternalTakeRadialDamage(). If the "Actual Damage" ends up with 0, the "ReceiveAnyDamage" event will never be called.
answered Jun 30 '15 at 03:01 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here