I know how to get methods and parameters. The problem I am having is using a public variable that is set in the editor and getting its methods and variables. Truly what I want is to drag in a script and choose which function to use from that script. All I really need is a an example. I am not asking for a full script or anything just something to guide me on my way to figure it out. Cheers!
Add a public variable of type unity event in your script like this.
public UnityEngine.Events.UnityEvent callBack;
and whenever you want to invoke function in script simple do.
callBack.Invoke();
Well to use a public variable in my other public variables I used a Singleton but I still have a problem with my dropdown menu so I will make a new question for that. Thank you for replying @dev-waqas. Cheers and here is a Singleton:
Script:
public class ObjectManager : MonoBehaviour
{
// singleton
private static ObjectManager m_Instance = null;
public static ObjectManager Get()
{
if (m_Instance == null)
m_Instance = (ObjectManager)FindObjectOfType(typeof(ObjectManager));
return m_Instance;
}
// class
public MonoScript ComponentToUse;
}
How to use in other classes:
ObjectManager .Get().ComponentToUse;
I know I needed to use a UnityEvent but thats about as far as I have gotten.