unity oncollisionenter2d
void OnCollisionEnter2D(Collision2D col)
{
//This method will run when your 2D game object
//collides with something
Debug.Log("Collided");
}using UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour {
void OnCollisionEnter2D(Collision2D coll) {
if (coll.gameObject.tag == "Enemy")
coll.gameObject.SendMessage("ApplyDamage", 10);
}
}
Also in C#:
- unity cycle children
- iframe set html content c#
- web api startup add imemory cache object
- c# math to radiant
- ecs get specific entities with component
- c# random number between 0 and 1
- how to update a project to cross target .net core
- get string character by index c#
- C# get all child classes of a class
- c# string to character array
- c# datetime dd/mm/yyy hh:mm:ss
- how to disable a gameObject unity c#
- C# resize window without title bar
- how to change scenes in unity
- string isnullorempty vs isnullorwhitespace
- unity face direction of movement
- .net loop through dictionary
- How to get number of months between 2 dates c#
- how to convert object in string JSON c#
- how to put double quotes in a string c#
- c# static meaning
- unity get velocity at point
- C# extend array
- how to make an object move in unity