Question by 
               SilverFang123 · Dec 28, 2015 at 07:23 AM · 
                rotationinstantiateparent  
              
 
              Rotation of instantiated object
Just to remind y'all that I just started learning c#, so I'm a complete newbie.
So basically, I want the instantiated prefab's rotation to be the same as the parent of the parent of the script.
 example. 
- Player 
- ^Script's Parent 
- ^Script 
soo please i really need help D:
code:
 using UnityEngine;
 using System.Collections;
 using System;
 
 public class Spawn : MonoBehaviour {
     public GameObject Sphere;
     GameObject SphereClone; //its actually a block, but im too lazy to rename everything XD
   public bool canClick;
     public float cd = 70f; //cooldown timer
     Vector3 temp;
   
     
     void Update () { //cooldown 
         if (canClick == false)
         {
             cd -= 1;
         }
         if (cd == 0f)
         {
             canClick = true;
             cd = 70f;
         }
         if (Input.GetButtonUp("Fire1")&& canClick == true)
         {
            
             Debug.Log("false");
             canClick = false;
             Inst(); //instantiates the block
                                  
         }
     }
     void Inst() //instantiator 
     {
         SphereClone = Instantiate(Sphere,transform.position, Quaternion.identity) as GameObject;
         temp = transform.localScale;
         temp.y += 5f;
         transform.localScale = temp;
         Destroy(SphereClone, 3);
 
 
     }
 }
 
 
               Comment
              
 
               
              Answer by unity-huunity · Dec 28, 2015 at 09:18 AM
Try that:
 Transform parentOfTheParent = transform.parent.parent;
 Quaternion rotationOfTheParentOfTheParent = parentOfTheParent.rotation;
 SphereClone = Instantiate(Sphere,transform.position, rotationOfTheParentOfTheParent) as GameObject; 
 
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                