summaryrefslogtreecommitdiffstats
path: root/Third_Party/at.pimaker.ltcgi/Runtime/LTCGI_ExampleToggle.cs
blob: 290f498758b7b8163f2e850c9d299192ecec944a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#if UDONSHARP
using UdonSharp;
using UnityEngine.Serialization;

// NOTE: This script has to be in the "_LTCGI/Scripts" folder, *or* reference
// the "LTCGI_AssemblyUdon" to allow it to use the "LTCGI_UdonAdapter" type!

[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
public class LTCGI_ExampleToggle : UdonSharpBehaviour
{
    // set this to your controller object (specifically the adapter object):
    [FormerlySerializedAs("Adapter")]
    public LTCGI_UdonAdapter LTCGI_Controller;

    // set this however you want:
    public bool StartingState = true;
    private bool state;

    void Start()
    {
        state = StartingState;
        LTCGI_Controller._SetGlobalState(state);
    }

    // you can make this a UI event as well!
    public override void Interact()
    {
        state = !state;
        LTCGI_Controller._SetGlobalState(state);
    }
}
#endif