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