5/24/21

 

 

 

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class IFS_3D_1 : MonoBehaviour
{

    public GameObject blankGO;


    void Start()
    {
        GameObject go;
        GameObject goWalk;
        Transform temp;


        for (int i = 0; i < 3; i++)
        {
            go = Instantiate(this.gameObject);
            go.GetComponent<IFS_3D_1>().enabled = false;
            temp = transform.GetChild(0);
            goWalk = temp.gameObject;

            int cnt = 1;
            while (temp.childCount != 0)
            {
                goWalk = temp.gameObject;
                temp = temp.GetChild(0);
                cnt++;
            }
            goWalk = temp.gameObject;
            go.transform.localPosition = goWalk.transform.localPosition;
            go.transform.localRotation = goWalk.transform.localRotation;
            go.transform.localScale = goWalk.transform.localScale;

            go.transform.SetParent(goWalk.transform,false);
            //go.transform.parent = goWalk.transform;
        }
    }


    void Update()
    {
        
    }
}