Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class GroundDetection : MonoBehaviour
- {
- [SerializeField] private bool isGrounded;
- public bool IsGrounded { set { isGrounded = value; } }
- private void OnCollisionEnter2D(Collision2D col)
- {
- if (col.gameObject.CompareTag("Platform"))
- {
- isGrounded = true;
- }
- }
- private void OnCollisionExit2D(Collision2D col)
- {
- if (col.gameObject.CompareTag("Platform"))
- {
- isGrounded = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment