среда, 1 февраля 2012 г.

Unity3d BCE0019: component is not a member of 'Object'

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

Комментариев нет:

Отправить комментарий