dc17.
dc17.
CC#
Created by dc17. on 4/12/2023 in #help
How to wait 2 seconds before activating a part of code?
my goal is to make the
rb.isKinematic = false
rb.isKinematic = false
work after 2 seconds. here is my code;
using UnityEngine;

public class GravityOn : MonoBehaviour
{
private Rigidbody rb;

void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
{
// Code to trigger when the collision occurs
print("Gravity");

rb = GetComponent<Rigidbody>();
rb.isKinematic = false;
}
}
}
using UnityEngine;

public class GravityOn : MonoBehaviour
{
private Rigidbody rb;

void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
{
// Code to trigger when the collision occurs
print("Gravity");

rb = GetComponent<Rigidbody>();
rb.isKinematic = false;
}
}
}
thank you! 🙂
27 replies