Question by
anthonybentson · Jan 29, 2020 at 11:25 PM ·
2dtransformtrigger
Spawning my prefab on a transform point on TriggerEnter
Hey, I've made a insanely basic "Turret" script that should be spawning my bullet prefab on TriggerEnter, but nothing happens when the player enters the Collider
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TurretAIV2 : MonoBehaviour
{
public Transform FirePoint;
public GameObject Round2Fire;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void OnTriggerEnter2D()
{
if (gameObject.tag == "Player")
{
Instantiate(Round2Fire, FirePoint, FirePoint);
}
}
}
Comment