unity 2d ontriggerenter2d same parameter error 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().EnAttackAnim(true);
}
}
void OnTriggerExit2D (Collider2D veri){
if(veri.gameobject.tag == "FieldOfView") {
MainCamera.GetComponent().EnAttackAnim(false);
}
}
void OnTriggerEnter2D (Collider2D veri){
if(veri.gameobject.tag == "FieldOfView") {
MainCamera.GetComponent().PlBustedAnim(true);
}
}
void OnTriggerExit2D (Collider2D veri){
if(veri.gameobject.tag == "FieldOfView") {
MainCamera.GetComponent().PlBustedAnim(false);
}
}
void Start() {
FOVAnimator = GetComponent();
PlayerAnimator = Player.GetComponent();
EnemyAnimator = Enemy.GetComponent();
}
void Update() {
}
}