Question by
kaitabuchi · Oct 08, 2021 at 01:55 AM ·
not workingcollision2d
OnCollisonStay2D not working please help!
OnCollisonStay2D not working, I have a script to make a gameobject active when the cat is touching the player and when the space bar is pressed for my speech bubble. but it is not working. and I am 7 so please go easy on me. here's my script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class kitcattalk : MonoBehaviour
{
public GameObject talkBox;
private void OnCollisionStay2D(Collision2D collision)
{
Debug.Log("collison enter");
if (collision.collider.tag == "Player")
{
Debug.Log("tag enter");
if (Input.GetKeyDown(KeyCode.Space))
{
Debug.Log("key enter");
talkBox.SetActive(true);
}
}
}
}
Comment