Int/Float Default Value Is Always 0

Hi!

I’ve encountered this bug a few time already, and I couldn’t find if it has been already reported. Some variables that I’ve just created in a blueprint have their default value equal to zero despite the fact that I’ve set another number in the Details Panel. I had this bug on two floot variables and one int variable already.

As you can see in the pictures, I have a variable that is printed in the begin play event (I can confirm it is not set by another blueprint beforehand) et the print return zero despite having the default value set to 5. The blueprint is compiled, and I’ve tried to build the game and restart UE4.18.0 but the only way to fix this is to delete the variable and make a new one from scratch.

I don’t really know how to reproduce this issue. The first two times with the float variables I thought it was because I duplicated another variable to create them, but this time I believe that I made the int variable from scratch.

I’ll update this post if I find how to reproduce the bug. If you could investigate despite the lack of hints it would be awesome!

Hello Sly,

We are unable to reproduce this issue on our end. I have a couple of questions to help investigate the issue you are experiencing further.

  1. Is this issue occurring in a C++ project or in a blueprint project?
  2. Is this issue only occurring in version 4.18 for you?
  3. In the screenshots you provided, the blueprint was compiled but not saved, does saving the blueprint correct this issue?

Please let us know if you are able to get a repro on this issue.

Thanks!

Its a stretch but try deleting your Saved and Intermediate folders in your game project folder. It usually clears out any strange issues I have at times. more info here…

Hello Sly,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will follow up.

Thanks!

I am getting the exact issue described above

I just tried what you suggested but no change in behaviour.

Using 4.20.3
Project is blueprint based but have a C++ Character and Character Movement class.

Saving blue print does NOT fix the issue. Restarting the editor did NOT fix the issue.

Its like the variable isn’t initialised correctly despite me setting the default values.

Okie I think I found a solution to this possible symptom.

For context:-

  • My game is on 4.20.3
  • I am using blueprints, but have some C++ (not sure if this plays into the bug)
  • I have a parent character blueprint that I’m building a majority of my functionality and default variable values into
  • When my game starts I spawn in a character which is one of many child blueprints of the main parent blue print
  • The child blueprint does NOT seem to have the default values that were set in the parent blue print. They were all Zero

The variables that were resetting to zero in the child blueprints had been newly DUPLICATED through the editor and setup with default values after renaming them. (I had been doing this duplicating on the parent blue print, I had NOT been touching the child blueprint at all)

What I discovered when diving into my child blueprint; after I enabled the editor to show Inherited Variables; was that little yellow arrow icon next to the problem variables. For some reason my child blueprint was NOT using the default values.

I clicked the little yellow arrow icon through the entire child blueprint on the inherited values and the problem was fixed! :smiley:

Actually I think I solved the issue, see submitted answer

This issue is still relevant in version 4.24.2. The comment from user ChiggenWingz allows you to solve the problem. I also don’t understand how to reproduce the problem. As mentioned above, it occurs when working with derived classes, and possibly appears when there are a large number of variables in the parent class.

This solves my problem thanks.

I’m having this issue… I’m trying to make an ammo system and the variables in Weapon Blueprint keep coming back 0. I’m using blueprint and UE5.