当我的玩家在这个地方选择一个项目但是我没有得到它时,我想要实例化一个敌人。这是我放在项目中的代码。
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class SpawnEnemies : MonoBehaviour {
public GameObject spawnPosition;
public GameObject spawnObject;
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "player"){
Instantiate(spawnObject, spawnPosition.transform.position, spawnPosition.transform.rotation);
}
}
}