I'm using:
public GameObject target;
private ValueField valueField;
void Awake (){
valueField = target.GetComponent();
}
void OnMouseDown ()
{
valueField.addValue(value);
}
It works great. I can set the target GameObject by drag and dropping it into the unity property inspector.
I was wanting to also set the "Class" or "Script" or what ever you call it in the property inspector too. so something like:
public varTargetGameObject;
public varClassName;
private varTargetInstance;
varTargetInstance = varTargetGameObject.GetComponent(varClassName);
Can you do something like that?
What's the correct syntax?
↧