Hello, I’m having a simple issue but I’m not sure how to resolve it.
I have an “EnemySpawnTrigger”, when the player enters the trigger, an enemy prefab is instantiated.
public class EnemySpawnScript : MonoBehaviour {
public GameObject EnemyPrefab;
public Transform EnemySpawnZone;
void OnTriggerEnter(Collider other)
{
if(other.gameObject.CompareTag("Player"))
{
Instantiate(EnemyPrefab, EnemySpawnZone.position, EnemySpawnZone.rotation);
}
Destroy(this.gameObject, 0.5f);
}
}
The problem is, my “FPSController” has a “Capsule Collider (isTrigger)” attached to it, it has a smaller radius than the “outline of the Character Controller”.
Basically, when I enter the trigger, the “outline of the Character Controller” instantiates one prefab.
Then, a split second later, the inner “Capsule Collider” instantiates a second prefab. (Unwanted)
The reason I’m using the “Capsule Collider” is for Parenting the Player with an elevator/ platform system. So, I would like to keep it there if possible.
Any solutions? Any help would be greatly appreciated, Thanks!