- Home /
 
               Question by 
               mail2sawan · Aug 05, 2015 at 06:05 AM · 
                positionscriptingbasicsrandom.range  
              
 
              How i get my cloud position in other script? I want to use this temp value in other script.
 void CreateClouds(float positionY) {
 
         Shuffle (clouds);
 
         for (int i = 0; i < clouds.Length; i++) {
 
             clouds [i] = Instantiate (clouds [i], Vector3.zero,Quaternion.identity) as GameObject;
             Vector3 temp = clouds [i].transform.position;
 
             float randomX = Random.Range (minX, maxX);
 
             temp.x = randomX;
             temp.y = positionY;
             
             lastCloudPositionY = temp.y;
             
             clouds [i].transform.position = temp;
             
             positionY -= distanceBetweenClouds;
 
         }
     }
 
               Comment
              
 
               
              Shouldn't you tell me that? ;-)
You haven't posted "the other script" but you have temp setup as a Vector3, so whatever field/property/method you wanted to pass temp into
Answer by Cynikal · Aug 05, 2015 at 08:24 AM
Make clouds public. Then reference the script, and do something like:
theObjectTheCloudsScriptIsOn.GetComponent().Clouds
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                