OnTriggerEnter2DThis message parameter has to be of type: Collider2D code example
Example: unity 2d ontriggerenter2d same parameter error
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FieldOfView : MonoBehaviour
{
public GameObject Player, Enemy, MainCamera;
public Animator FOVAnimator, PlayerAnimator, EnemyAnimator;
void OnTriggerEnter2D (Collider2D veri) {
if(veri.gameObject.tag == "FieldOfView") {
MainCamera.GetComponent<AnimationControl>().EnAttackAnim(true);
}
}
void OnTriggerExit2D (Collider2D veri){
if(veri.gameobject.tag == "FieldOfView") {
MainCamera.GetComponent<AnimationControl>().EnAttackAnim(false);
}
}
void OnTriggerEnter2D (Collider2D veri){
if(veri.gameobject.tag == "FieldOfView") {
MainCamera.GetComponent<AnimationControl>().PlBustedAnim(true);
}
}
void OnTriggerExit2D (Collider2D veri){
if(veri.gameobject.tag == "FieldOfView") {
MainCamera.GetComponent<AnimationControl>().PlBustedAnim(false);
}
}
void Start() {
FOVAnimator = GetComponent<Animator>();
PlayerAnimator = Player.GetComponent<Animator>();
EnemyAnimator = Enemy.GetComponent<Animator>();
}
void Update() {
}
}