Open geekrelief opened 5 years ago
To create Variables at runtime I did this. It should be mentioned in the docs.
public class SettingsConsoleVariables : MonoBehaviour { public Settings settings; public static CVar factor; private void Start() // Note: setup on Start not Awake { LunarConsole console = GetComponent<LunarConsole>(); factor = new CVar("factor", settings.factor); factor.AddDelegate(OnFactorUpdate); console.registry.Register(factor); // would be nice to say: factor = LunarConsole.Register("factor", settings.factor, OnFactorUpdate); } void OnFactorUpdate(CVar cvar) { settings.factor = cvar; } }
@geekrelief, unfortunately, it didn't end up as a quick fix. I have to think about better variables handling. Stay tuned...
To create Variables at runtime I did this. It should be mentioned in the docs.