Is it possible to make the code inside a void OnTriggerEnter(Collider other)
or a void OnCollisionEnter(Collision collisionInfo)
wait X seconds before carrying on.
Here’s the code I’m currently using:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Collision : MonoBehaviour
{
private Movement movement;
// Start is called before the first frame update
void Start()
{
movement = GetComponent<Movement>();
}
// Update is called once per frame
void OnTriggerEnter(Collider other)
{
if (other.tag == "Obstacle")
{
movement.enabled = false;
}
}
}