Merge branch 'gameplayglobal-getval' of https://github.com/Tryibion/FlaxEngine into Tryibion-gameplayglobal-getval

This commit is contained in:
2026-05-12 18:20:24 +02:00
+18
View File
@@ -0,0 +1,18 @@
namespace FlaxEngine;
partial class GameplayGlobals
{
/// <summary>
/// Gets a value of a given type from the global variables. (it must be added first).
/// </summary>
/// <param name="name">The name of the variable to retrieve.</param>
/// <typeparam name="T">The type of the variable to retrieve.</typeparam>
/// <returns>The value of the variable, or default if not found or type mismatch.</returns>
public T GetValue<T>(string name)
{
var obj = GetValue(name);
if (obj is T t)
return t;
return default;
}
}