Defaults set in character blueprint do not override c++

Blueprint doesnt overwrite default values of properties.

Hey 2rusbekov-

Are you not able to change a variable’s value in blueprints or are you referring to the default value being used in game instead of the blueprint value? Could you elaborate on your statement please?

Cheers

Doug Wilson

In game used value from c++ instead of blueprint value;

I’m still not sure what I understand what you’re seeing. I added a float variable in code and set it to 5.5 in the constructor. I then created a blueprint on this class and set the default value of the variable to 1.2 inside the blueprint. Adding a call to print the variable shows 1.2 in game. Could you explain how you’re setting up / changing the value of the variable?

I made class child of Character. I created float vars BaseMoveSpeed and RunSpeed. I set them to 170 and 600 in constructor.
Inside a blueprint in defaults tab I set BaseMoveSpeed to 250. In game variable is 170;

If this is a new and clean project, then it would be the easiest way to just upload this project and send it to Doug (you can post a link here).

If not, please try to recreate this in a clean project and then upload it.

If you can’t recreate it in a new project, maybe upload the project where it happens.

This way Doug can easier see what is going on. If you are not able to upload it, then it is ok too (: This would just help to speed things up.

Hey 2rusbekov-

The value not being updated in the blueprint seems to only affect blueprints who’s parent is a Character based class. Creating a code class based on Actor will display the correct value of a variable set in the blueprint. I have reported this bug (UE-12391) for further investigation. You can work around this by settin

Cheers

Doug Wilson

My team is experiencing this too on 4.7. We have a character BP class that inherits from a custom C++ character class that inherits from Character. The child blueprint classes of our character BP do not override a float value defined in the character BP root class. We have to set the overriding values programmatically with a function that triggers on each child class on Begin Play instead. We’ve noticed that the bug doesn’t occur when playing in editor – only when playing on packaged builds.

Hey David M-

Just to make sure I am following your workflow you have a character code class which is the parent of a blueprint. That blueprint is then the parent of another child_character blueprints? Is it in the child_character that the values are not showing correctly? Where in the child_character is the float value being set? Could you elaborate on your setup so that I can make sure I am following the same setup you’re using.

Cheers

Doug Wilson

I’m having this same issue with 4.10. FText used on a class that inherits from ACharacter. When child Blueprint class is made from my C++ class (which inherits from ACharacter) the data in the Blueprint class’ FText value is ignored and only what is set via C++ is shown.

Hey MiDri-

Could you explain how your FText is setup in code? I tried adding an FText variable to a character class and after creating a blueprint from the class and setting the default value, the value set in the blueprint was printed to the screen.

I’m on 4.11 and i’m experiencing a similar problem. I have a blueprint of a C++ class where I set a float value in the constructor and then override that value in the blueprint. In-game it appears to still use the default constructor value. Out of curiosity, is there a way to access the ‘blueprint default’ from C++ ? Something akin to Unrealscript’s : “default.MyValue” ? My current methodology is to just create an ‘initial’ version of the variable I want and then cache it in begin play and look it up when needed, but that seems really clunky.

Hey AJQuick-

Are you using a character class/blueprint or is the class you’re using based on something else (actor, game mode, etc.)? Are you setting the blueprint value in the details panel, in the construction script or on the Begin Play node of the blueprint?

Hi Doug

It’s a character subclass, yep. I’m setting the values in the details panel, not the construction script in the BP. Did a little digging and it looks like I can use GetClass()->GetDefaultObject()->SomeValue to pull the defaults I’m setting in the class constructor in C++, but I’m gonna go ahead and assume that won’t take into account any changes I make in the blueprint details panel :stuck_out_tongue:

I stand corrected. It does :slight_smile:

Can you give any more detail on exactly how you got the value out of “GetClass()->GetDefaultObject()”?

Spencerkohan

In my experience you have to cast is after you get the default object.

UObject* Object = Class->GetDefaultObject();

AActor* ObjectWithVales = Cast<AActor>(Object);

I experience the same issue with a pawn that inherits from a c++ class. this class holds a (custom) component.
everything works just fine and I can change the values of the component in the blueprint. however, when I hit play the base value from the constructor are used.

I’m having this exact same problem.
I have a default value set in my C++ constructor. The value is a UPROPERTY so can be changed in the Blueprint version of the class, but when playing the game the C++ default constructor just overrides any value I’ve made in the editor.