I\'m currently having a trouble of getting the value of my enum from another script here\'s my script that handles the enum
TrafficLightHandler.cs
To be able to use the other script you need to retrieve it as any other component using GetComponent<TCompoenent>()
.
If both scripts are attached to the same gameObject
then just use current gameObject
var tlh = gameObject.GetComponent<TrafficLightHandler>();
...
tlh.Trafficlight
Otherwise, if scripts are attached to different object then you need the reference to the holder of that script to do actual retrieval.
public GameObject otherScriptHolder;
var tlh = otherScriptHolder.GetComponent<TrafficLightHandler>();
...
tlh.Trafficlight