
作用:代码控制是否显示.SetActive(false);
using System.Collections;using System.Collections.Generic;using UnityEngine;public class shoot : MonoBehaviour{public GameObject B;// Start is called before the first frame updatevoid Start(){GameObject a = GameObject.Instantiate(B);//实例化GameObject b = GameObject.Instantiate(B,transform.position,transform.rotation);b.SetActive(false);}// Update is called once per framevoid Update(){}}
using System.Collections;using System.Collections.Generic;using UnityEngine;public class shoot : MonoBehaviour{public GameObject B;// Start is called before the first frame updatevoid Start(){GameObject a = GameObject.Instantiate(B);//实例化GameObject b = GameObject.Instantiate(B,transform.position,transform.rotation);b.SetActive(false);//隐藏b}// Update is called once per framevoid Update(){}}