If master were a GameObject or Component, then what'd you actually need is
selected = (master.GetComponent("Master_control") as Master_control).selected;
But that uses the GetComponent that takes a string, which is no good. You could improve its performance by doing
selected = (master.GetComponent(Master_control) as Master_control).selected;
But that's long. Use the generic form, which is as yet undocumented. :-P
selected = master.GetComponent.<Master_control>().selected;
Source
Комментариев нет:
Отправить комментарий