I'm using unity combined with c# but I'm having trouble with navigating the hierarchy from within my scripts to get access to specific components.
For example my hierarchy looks like this:
Box02 got a component in which needs access to the camera component in the Main Camera.
I've figured that what I need to do should be to somehow navigate to the Main Camera gameObject and then use the getComponent function but I'm not sure how to do it. I tried getting to the Ship gameObject by using transform.parent but that didn't seem to work.
I've been trying to find a good resource which explains this but I cant find one.
I finally found something that helped me.
The first answer here helped my immensely so if anyone else runs in to similar trouble then go here.
Edited by Psilobe, 19 February 2013 - 11:17 AM.