Trigger Events in Unity made EASY in this simple C# Tutorial




In this video, we talk through our goals for this 2 part series, the basics of creating a trigger collider, rigid body, C# script, and event setup for a trigger input. In Unity 6.1, we go line by line through the C# script that will enable you to add simple triggered events in your projects.

Script –
using UnityEngine;
using UnityEngine.Events;

public class TriggerEvent : MonoBehaviour
{
public UnityEvent uEvent;
public GameObject TriggerObject;

public void OnTriggerEnter(Collider collider)
{
if (collider.gameObject == TriggerObject)
uEvent.Invoke();
}
}

Voir sur youtube

Nous serions ravis de connaître vos opinions.

Laisser un commentaire

KA2Studio
Logo
Compare items
  • Total (0)
Compare
0