Script-点击鼠标左键触发

public class Test : MonoBehaviour {
    public GameObject getBulle;

    GameObject bullet;

    // Use this for initialization
    void Start () {
        
    }
    
    // Update is called once per frame
    void Update () {
        if (Input.GetButton ("Fire1")) {
            bullet =  Instantiate (getBulle);
            bullet.transform.parent = this.transform;
        }
    }
}

你可能感兴趣的:(Script-点击鼠标左键触发)