Two errors:
‘Player’ does not contain a definition for ‘ComapreTag’ and no accessible extension method ‘ComapreTag’ accepting a first argument of type ‘Player’ could be found (are you missing a using directive or an assembly reference?)
‘Collider’ does not contain a definition for ‘ComapreTag’ and no accessible extension method ‘ComapreTag’ accepting a first argument of type ‘Collider’ could be found (are you missing a using directive or an assembly reference?)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Player : MonoBehaviour
{
[SerializeField] KeyCode keyOne;
[SerializeField] KeyCode keyTwo;
[SerializeField] Vector3 moveDirection;
private void FixedUpdate()
{
if (Input.GetKey(keyOne))
{
GetComponent<Rigidbody>().velocity += moveDirection;
}
if (Input.GetKey(keyTwo))
{
GetComponent<Rigidbody>().velocity -= moveDirection;
}
if(Input.GetKey(KeyCode.R))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
if(Input.GetKey(KeyCode.Q))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
}
private void OnTriggerEnter(Collider other)
{
if(this.ComapreTag("Player") && other.ComapreTag("Finish"))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
}
}