title: How to retrieve the prefab clone into the script when it is instantiated?
body: <p>I am trying to create level prograss bar, here is the script to fill the Slider along with ball when its moving towards finish line , here finish line is prefab clone which is randomly instantiated at different position. but as expected finishTransform using position(0, 0, 0) from prefab not from the clone. how can i retrieve the clone into the script when it is instantiated? here is the Progressbar Script :</p>
  
  <pre><code>[SerializeField] Transform ballTransform;
   [SerializeField] Transform finishTransform;
   [SerializeField] Slider slider;
  
   float maxDistance;
  
  
  
   void Start()
   {
       maxDistance = getDistance();
   }
  
   void Update()
   {
       if (ballTransform.position.z &lt;= maxDistance &amp;&amp; ballTransform.position.z &lt;= finishTransform.position.z)
       {
           float distance = 1 - (getDistance() / maxDistance);
           setProgress(distance);
       }
   }
  
   float getDistance()
   {
  
       return Vector3.Distance(ballTransform.position, finishTransform.position);
   }
  
   void setProgress(float p)
   {
       slider.value = p;
   }
  </code></pre>
  
  <p>Here is the Platform script where i instantiated the finish line</p>
  
  <pre><code>GameObject finalPlatformInstance = Instantiate(finalPlatform, transform);
       finalPlatformInstance.transform.localPosition = new Vector3(0, 0, spawnPosZ);
  </code></pre>