[Question] Default Variable Values

So in UnrealScript, we had ClassName.default.VariableName / default.VariableName;

Is there an equivalent means of accomplishing this in C++? And if so, how do you do it? This was a pretty indispensible feature, and having to code two sets of variables for everything in code is going to be an enormous time sink.

So if there isn’t an easy way to do this in C++ already, I’d like to request some means of making very similar functionality available so that there’s not all this extra typing that has to be done to accomplish equivalent UnrealScript.

Get the default you will need to get the default object of your class, example below:

SomeProperty = GetClass()->GetDefaultObject()->SomeProperty

Set them in the constructor. I’ve added a programmer in case you have any related questions.

Best Regards,

Ryan

Hey Markus,

Are you talking about calling that variable the two different ways or setting it?

Best Regards,

Ryan

Little of both, really. I know that the constructor is the equivalent of defaultproperties, but does C++ store a ‘default’ version of the variable through the constructor, too? If not, I’m not certain how I would create a default value to access later.

I thought about just making a static getter to access a member, but does the constructor get called when static methods are invoked? If not, then it doesn’t make sense for me to do things that way.

So yeah… confusion abound about how to get started making default values and reading from them.