Skip to content

Cache and allow access of global state in LTCGI_UdonAdaptor #23

@Janooba

Description

@Janooba

In order to display feedback for options panels controlling the enabled state of LTCGI, I've had to modify the UdonAdaptor to cache the enabled state and provide a getter for it.

Here's what I've done:

    private bool isGlobalStateEnabled = true;
    public bool GlobalStateEnabled
    {
        get => isGlobalStateEnabled;
    }
    public void _SetGlobalState(bool enabled)
    {
        float fstate = enabled ? 1.0f : 0.0f;
        GlobalShader.SetGlobalFloat(GlobalShader.PropertyToID("_Udon_LTCGI_GlobalEnable"), fstate);
        isGlobalStateEnabled = enabled;
    }

Super super simple, but helps a lot. If there's a better or different way to access this value I missed, let me know.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions