Untitled
unknown
plain_text
2 years ago
1.1 kB
2
Indexable
Never
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlacementHelper : MonoBehaviour { // Start is called before the first frame update void Start() { GetComponent<SpriteRenderer>().color = Color.green; } private bool _paused; private Rigidbody2D _body; private void Awake() { _body = GetComponent<Rigidbody2D>(); } // Update is called once per frame void Update() { _body.isKinematic = true; } private void OnCollisionStay2D(Collision2D collision) { Debug.Log("stay"); GetComponent<SpriteRenderer>().color = Color.red; } private void OnCollisionExit2D(Collision2D collision) { Debug.Log("exit"); GetComponent<SpriteRenderer>().color = Color.green; } private void OnTriggerEnter2D(Collider2D collision) { Debug.Log("OnTriggerEnter"); } private void OnTriggerStay2D(Collider2D collision) { Debug.Log("Ontriggerstay"); } }