diff --git a/Source/Engine/Engine/GameplayGlobals.cs b/Source/Engine/Engine/GameplayGlobals.cs new file mode 100644 index 000000000..9dabae525 --- /dev/null +++ b/Source/Engine/Engine/GameplayGlobals.cs @@ -0,0 +1,18 @@ +namespace FlaxEngine; + +partial class GameplayGlobals +{ + /// + /// Gets a value of a given type from the global variables. (it must be added first). + /// + /// The name of the variable to retrieve. + /// The type of the variable to retrieve. + /// The value of the variable, or default if not found or type mismatch. + public T GetValue(string name) + { + var obj = GetValue(name); + if (obj is T t) + return t; + return default; + } +}