Answers for "how to make dissapear an object in unity"

C#
0

how to make dissapear an object in unity

public class Player : MonoBehaviour
{
    //Set this game object by dragging on UI
    public GameObject body;

    private void OnCollisionEnter2D(Collision2D other) {
      if(body != null){
        body.GetComponent<Renderer>().enabled = false;
        Destroy(body);
      }
    }
}
Posted by: Guest on October-23-2021

Code answers related to "how to make dissapear an object in unity"

C# Answers by Framework

Browse Popular Code Answers by Language