Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

oncollisionenter compare tag

private void OnCollisionEnter2D(Collision2D col)
    {
    	//for "OnCollision" you need "gameObject" listed not just "CompareTag"
        if (col.gameObject.CompareTag("weapon"))
        {
            Destroy(gameObject);
        }
    }
Comment

PREVIOUS NEXT
Code Example
Csharp :: how is c# pronounced 
Csharp :: delete all dir content c# 
Csharp :: console writeline unity c# 
Csharp :: unity object to mouse 
Csharp :: how to convert iformfile to byte array c# 
Csharp :: How to add a label programatically in c# 
Csharp :: unity dontdestroyonload 
Csharp :: wpf update listview itemssource 
Csharp :: Unity asset storre download forlder 
Csharp :: unity copy list 
Csharp :: c# @ before string 
Csharp :: c# read from file 
Csharp :: alphabet string[] c# 
Csharp :: c# decimal to hex 
Csharp :: despicable me 
Csharp :: bootstrap distane between col 
Csharp :: video gets pixelated unity 
Csharp :: c# how do you check if a string contains only digits 
Csharp :: words counter c# 
Csharp :: discord bot status code c# 
Csharp :: how to clear datagridview c# 
Csharp :: how to move towards an object unity 
Csharp :: 2d game art 
Csharp :: how to name GameObject in c# 
Csharp :: c# sqlite query 
Csharp :: base64 decode how used in c# 
Csharp :: copy text from a text box c# 
Csharp :: c# check if 2d array position exists 
Csharp :: Cursor Lock and Visible in Unity 
Csharp :: unity mouse click position 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =