Answers for "unity 2d collision"

C#
10

unity oncollisionenter2d

void OnCollisionEnter2D(Collision2D col)
    {
		//This method will run when your 2D game object
      	//collides with something

      	Debug.Log("Collided");
    }
Posted by: Guest on February-15-2020
2

unity 2d collision

void OnCollisionEnter2D(Collision2D col) {
  Debug.Log("Collided with: " + col.gameObject.name);
}
Posted by: Guest on October-14-2020
3

oncollisionenter2d

using UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour {
    void OnCollisionEnter2D(Collision2D coll) {
        if (coll.gameObject.tag == "Enemy")
            coll.gameObject.SendMessage("ApplyDamage", 10);
        
    }
}
Posted by: Guest on April-08-2020
1

collision detector unity c# 2d

void OnCollisionEnter2D(Collision2D coll){)
Posted by: Guest on June-11-2020

C# Answers by Framework

Browse Popular Code Answers by Language