immersivecognition / unity-experiment-framework

UXF - Framework for creating human behaviour experiments in Unity
https://immersivecognition.github.io/unity-experiment-framework/
MIT License
221 stars 43 forks source link

Cannot reference Session to Sub State Machine Script #58

Closed Francodibrotsy closed 3 years ago

Francodibrotsy commented 3 years ago

Hi

I'm programing a simple task with the tool of state machine behavior in unity. I did the session public variable, and I can see it in the inspector, but I cannot reference the UXF rig to the Session space.

Question

The Script is simple but doesn't allow to drag and put the UXF rig on it. Do you know how I can fix that? Thanks!

jackbrookes commented 3 years ago

You cannot reference scene objects in a StateMachineBehaviour, this is an issue with Unity not UXF: https://answers.unity.com/questions/998692/cant-assign-active-gameobjects-to-public-variables.html

You could try var session = FindObjectsOfType<UXF.Session>() in your script, or somehow link the state machine to some other code that you write that is attached in your scene.