Skip to content

Eventlistener i.e. OnSessionBegin #73

Answered by jackbrookes
thefirstfloor asked this question in Q&A
Discussion options

You must be logged in to vote

it should just work the same way as a unity event:

https://docs.unity3d.com/ScriptReference/Events.UnityEvent.AddListener.html

However they need to take the Session as an argument e.g.

void Start()
{
    session.onSessionBegin.AddListener(DoStuff);
}

void DoStuff(Session mySession)
{
    Debug.Log("Hello");
}

or even

void Start()
{
    session.onSessionBegin.AddListener((s) => Debug.Log("Hello"));
}

Note though, these listeners will be added, but will not show up the UI. They will be removed when you exit play mode.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@thefirstfloor
Comment options

Answer selected by thefirstfloor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants