- Home /
 
 
               Question by 
               PeaceToFar · Aug 01, 2013 at 02:57 AM · 
                search  
              
 
              Find gameobject it refer to
A and B are all gameobjects in the scene. A has a member c that refer to B. when click c in the scene, the editor navigate to B automatically. How could I find B by c at runtime in codes?
               Comment
              
 
               
              Answer by Peter G · Aug 01, 2013 at 03:24 AM
I think you want GetComponent.<>() but this question is a little vague.
 //Attached to GameObject A    
 var c : YourScriptNameHere;
 var b : GameObject;
 
 function Start () {
      c = GetComponent.<C>();
      b = c.whateverVariableReferencesB;
 }
 
              Your answer
 
             Follow this Question
Related Questions
searching a text file for a player-input string 0 Answers
WP8 - Hadndling the Home and Search Button 1 Answer
How to get a random image url from google image search 0 Answers
Search hierarchy by value? 0 Answers
Select texture list 2021 0 Answers