Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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);
      }
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: writeline in C# 
Csharp :: class merging 
Csharp :: Deserialize a Dictionary 
Csharp :: c# show existing form 
Csharp :: windows forms webbrowser navigate 
Csharp :: Get cell value with formatting openxml 
Csharp :: c# break file into words 
Csharp :: Photon Join Room 
Csharp :: C# Move Camera Over Terrain Using Touch Input In Unity 3D 
Csharp :: c# ienumerable unassigned 
Csharp :: Filter list contents with predicate (anonymous method) 
Csharp :: == vs equals c# 
Csharp :: xunit setup throw exception 
Csharp :: Display all members of class using a for loop vb.net 
Csharp :: c# class where T : enum 
Csharp :: set windows theme in c# 
Csharp :: c# alert message 
Csharp :: object escape player unity 
Csharp :: get path revit link unloaded 
Csharp :: how to collect input from a user in discord bot c# 
Csharp :: c# azure get vm get cpu usage 
Csharp :: create new directory netrw 
Csharp :: alpahbet incremnet in c# 
Csharp :: reference variable from another script "winforms" c# 
Csharp :: unity customize hierarchy window 
Csharp :: unity camera movement script 
Csharp :: www.elking.net 
Csharp :: CharacterController 
Csharp :: closing main window after clicking on a button that opens another window in wpf 
Csharp :: C# Associativity of Operators 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =