Where to put global constants?

I want to add some global constants, available to all my classes. An example would be to add a constant for an empty vect(0,0,0) (named something like VECTOR_NONE, similar to INDEX_NONE == -1). So i can use it for functions that return a vector, but fail to find a location, ran than explicitly retruning vect(0,0,0) every time.

Any ideas on this?

I think you can create your own macros (similar to log etc.) for examples see Development/Src/Core/Globals.uci

Another option would be a class with static getter functions like this


class GlobalConstants extends Object
	abstract;

static function vector GetZeroVector()
{
	return vect(0.0f, 0.0f, 0.0f);
}

//more functions

defaultproperties
{
}

Usage:


function vector SomeOtherFunction()
{
	//if do something and return a non-zero vector

	//else
	return class'GlobalConstants'.static.GetZeroVector();
}

p.s. I haven’t used unreal script for a while so some of the above may not compile as is :slight_smile:

Thanks for the suggestions @UnrealEverything :slight_smile: I’ll check that stuff out.