Answers for "how to destroy instance in c# unity"

C#
-2

destroy gameobject unity

void OnTriggerEnter()
{
    if(PlayerPrefs.GetInt("GotPotion", 0) == 0)
    {
        // You didn't get the potion yet, so get it
        Destroy(gameObject);
        PlayerPrefs.SetInt("GotPotion", 1); // got the potion
    }
}
Posted by: Guest on March-24-2022

Code answers related to "how to destroy instance in c# unity"

C# Answers by Framework

Browse Popular Code Answers by Language