Whats the correct way it should be written?
using UnityEngine;
using System.Collections;
public class GroundCheck : MonoBehaviour {
private Player player;
void Start () {
player.gameObject.GetComponentsInParent ();
}
void OnTriggerEnter2D(Collider2D col){
if (null == player) {
Start ();
}
player.grounded = true;
}
void OnTriggerStay2D (Collider2D col){
player.grounded = true;
}
void OnTriggerExit2D(Collider2D col){
player.grounded = false;
}
}
↧