Is it possible to declare const variables in Blueprint? In UnrealScript we could use “const SomeInteger = 1;”
Have you tried just declaring the property const in your blueprints header?
Something like:
UPROPERTY(EditDefaultsOnly, Category=Pawn)
const UParticleSystem* JumpFX;
Hi Michael,
Sorry am not using C++. Sticking with Blueprints only for now. If the const option is not yet available i request that as a feature.
I’d think the best way would be to not expose the variable to be edited…
If you’re not using C++, then unfortunately there’s not a way to do this purely in blueprints. I’ll TTP the feature request!
Thanks!
Thanks Nick. Creating const variables right inside BP would be nice including the option to set the value using basic calculations like: const Something = pi / 180.
Hello
Variables in blueprint can both be read and modified, you can use a ‘Get’ or ‘Set’; the former reads the value and does not modify it while the latter modifies the value, if you do not wish to modify the variable you can create a getter for it and set it’s value on the blueprint defaults, make sure you’ve compiled the blueprint beforehand.
Using the UPROPERTY macro on C++ would enable you to set the variable to BlueprintReadOnly and/or EditDefaultsOnly; doing that on blueprint however does not seem to be possible on Rocket - another member of support should be able to confirm that.
Thank you.
you can do it in blueprints similar to the ancient C “#define” constant: