unity Instantiate实例化指定父物体

public GameObject shili;
    private bool isEnter = false;
    private GameObject zili;
    private GameObject weizhi;

    void Start()
    {
        weizhi = GameObject.Find("baifangwuti");
    }

    public void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.name == "bone31" )
        {
            if (isEnter == false)
            {
                zili = Instantiate(shili, new Vector3(0.03F, 0, 0), Quaternion.identity);
                zili.transform.parent = weizhi.transform;
                isEnter = true;
            }


        }
    }

你可能感兴趣的:(unity)