Triggering event on custom variable changed
Hi!
I'm trying to subscribe to changes made to a custom variables made using code generation. I created a UserStatesVariable based on a UserStates class defined as follows :
public enum UserStatus { headsetOff, headsetOn, readyToStart }
public class UserStates
{
public UserStatus selfStatus;
public UserStatus otherStatus;
public bool dataCollectionConsent;
}
My StatusManager.cs script has a method that I want to assign as a dynamic UserStates method with the following signature
private void UserStatesChanged(UserStates newState)
I first tried adding the following.
userStatesVariable.AddListener(delegate(UserStates value)
{
UserStatesChanged(value);
});
but changing the values of the UserStatesVariables wouldn't trigger any event.
I then tried adding the UserStatesVariable as a parameter to a GameEventListener, however, by doing so I am unable to assign the dynamic UserStatesChanged method
So I am left with using an extra event, called UserStatesGameEvent that I can use as an input to an UserStatesGameEventListener to assign to my UserStatesChanged(UserStates newState) method, which I would have liked to avoid.

Am I missing something or is it simply not possible to use a custom class as a variable that can be used to trigger events?