[4.7] - Defaults are zeroed out upon BP Construction

Hey Guys,

I am having an issue right now where default values within one of my Blueprints are being zeroed out before Construction Script is being run. I eventually realized that I had to manually click reset button next to each field in any BP that inherited that base class however it is not letting me reset private variables.

What I am having to do is manually uncheck private, reset field, then click private again as a solution. Is there an easier way or is this an issue with BP’s being upgraded to 4.7 where it should be taking inherited default value?

Also, considering its private, shouldn’t parent BP classes not have ability to override default value?

Thanks again!

I am experiencing same bug. If you have a parent class with a float with default value of say 100, and derive a child from it, child’s default will become 0 when you restart editor.

Thankfully that trick worked and now my Pawn is working again! But I’m guessing a bug took place when upgrading assets from 4.6.1 to 4.7 and should’ve carried defaults with it.

  • My only guess as far as how you could replicate it to look into further is create a new project in 4.6.1 and create a Blueprint w/ Pawn or any Actor as Parent Class.

  • Create a variable that can store a default value and set it to some value other than 0 but make it private. Then create another Blueprint that uses that previous BP as it’s parent.

  • At that point default should be same or probably not visible since it’s private.

  • Go ahead and retarget that project for 4.7 and you should notice that if you uncheck private on first BP, go into second BP you created that is child of first, you will now see it’s set to 0 and likely has reset icon next to it.

Hope this helps and thanks again!

I just figured it out, go ahead and uncheck those variables as private, go into child BP that are hiding those defaults and you should see it’s set to 0 but has yellow reset icon next to it. Click that then go back into Parent Blueprint and set it back to Private again and recompile. It’s a little bit of a pain but it does trick :smiley:

For some odd reason, this only works in editor and not in Standalone mode. I am still getting zeroed values and its not changing even after doing trick. I am going to try and clean my build and rebuild it in Visual Studio in hopes that makes difference but now I’m confused. Hopefully that takes care of it but its almost like what is being used in my Standalone Build is not being recompiled. As a note, I got same result from Packaging a build. mystery continues… Ohriginal, if you figure anything out, keep me posted. Appreciate it.

Also experiencing same bug, for both public and private variables of all types. It’s a very nasty issue so hopefully it it will get fixed soon!

Does setting derived bp’s variable to a different vaue than parent bp fix this for you? It fixes it for me, so I just zero parent’s variables however it’s still a very annoying bug.

If someone from Epic is willing to look into this, I can email a project with this bug.

Similar issue here.
I have few booleans in parent BP, and It’s not private.

When editor starts, this booleans set to “True” in parent BP by default. It’s ok.
But all childs have this set to “False”.

If change value in parent BP from “True” to “False”, and vise versa, and recompile parent BP, all childs get this parameters with last saved in parent (in this case - “True”)

Hi all,

This issue has been assigned to a member of our staff who will begun looking into it as soon as possible. Thanks for your patience!

Hi CodeSpartan,

If you’re able to put together a small test project for us, that would be great! Just put it somewhere online and let us know download link. Thanks!

Hello,

I’ve managed to narrow it down to what seems to be a circular dependency issue.

To reproduce:

  1. create a MyCharacter blueprint, add an int variable and set its default value

  2. create a MyCharacter_Child blueprint, based on first blueprint

  3. create an UMG widget with a button that when clicked, gets player character and tries to cast it to MyCharacter_Child

  4. in MyCharacter blueprint, create that widget in BeginPlay

  5. close project and reopen (you don’t even have to click play) - default value of int variable will be reset to 0 on child bp

Thanks for update, looking forward to fix! Hey CodeSpartan and , does this happen to you guys only in Standalone Mode? I had this happen but what I had to do was to uncheck Private and manually set default in any BP that inherited that base that contained those variables. This worked in editor but still doesn’t reflect in Standalone Mode, Launch or packaging a Staging Build.

This happens for me for both public and private variables so I didn’t try workaround.

Interesting. It definitely is some issue with inheritance. In your example above with MyCharacter_Child, if you look at values of those variables there that come from base class in child class, do defaults in child BP have your original defaults or are you seeing a 0 in there?

If I leave defaults unchanged, they are zeroed to 0 after editor restart and yellow arrow appears. For example if in parent I set variable’s default value to 200, and save both blueprints, child’s default value of that variable becomes 200 as it should, but only until editor restart.

Gotcha, well I’m hoping issue gets patched for next hotfix. Let us know if there is anything additional you need us to test. Thanks!

I have same problem, also looks like this: Problem with default values of variables being reseted - Programming & Scripting - Epic Developer Community Forums

Hi all,

We believe this is related to issue reported here:

which states:

This was caused by default values for
inherited values being initialized to
zero, rather than values in their
‘super’ blueprint. For instance, lets
say I have two blueprints: BP_Super,
and BP_Child. with BP_Child being
based on BP_Super. Values in BP_Child
could show up as 0, even if they were
set to something non-zero in BP_Super.

Thanks for pointing that out, Slavq! There is a GitHub pull request located here that should resolve issue for you, that will be included in 4.7.3 release:

https://github.com/EpicGames/UnrealEngine/commit/5b06ef7cd541deb6dc0c57fc7ed19868ba7a1916

Thanks for reports, everyone!

Thanks for update!

Guys, don’t try to add those changes manually, let’s wait for 4.7.3. I tried to add them and rebuilt engine and it broke custom enums in my project (I have version control so it’s ok)

Thanks for heads up CodeSpartan and glad to hear you had a backup.