Showing a private variable in the properties panel?

Hi there,

I just wanted to see if there was a way to show the value of a variable as non-editable in the properties panel?
I have my script as construction script and didn’t really want to start messing with widgets unless totally necessary.

Thanks for any assistance :slight_smile:

Harry Luck.

1 Like

I’m not one for coding :slight_smile: but thank you for your answer, i’ll keep a note in case i’m ever feeling brave :wink:
In the meantime, i guess i’m making some widgets :smiley:

Harry.

Hello,

Unfortunately you cannot do this is blueprints, (I really wish we could) It is easy to do in c++ though.

When creating a variable in c++ you can simply add VisibleAnywhere to its Uproperty and it will show up in the editor and not be editable.

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "MyCategory")
float MyFloatVariable;

The BlueprintReadOnly tag allows the variable to be accessed only as a blueprint getter.

And finally if the variable is always updating its value in the constructor based off of other variables values and you wanted the correct value to always show up in the editor for “MyFloatVariable” you would need to put that calculation inside the function PostInitProperties().

Your welcome. I understand, its intimidating at first, but its really not that bad when you get used to it.

A really good course that got me comfortable with it is Tom Loomans c++ course, if your interested, he worked at epic for awhile, he really knows his stuff. https://www.tomlooman.com/

I know its not the ideal solution but its currently the only one, so I ask if you could please mark the answer as correct so that others with a similar question could find this answer more easily? Thank you :slight_smile: