How to check what trigger player is touching and reference it as GameObject?


I’m having problem creating a script, where I want to make player check if it entered a trigger, if yes, what GameObject it is and reference it for later use. In script, I made a gameObject currentTriggerGameObject and a bool isInTrigger. For trigger, I’m using box collider as trigger. I don’t know if it’s suitable. I know just basics about programming and I’m learning mostly from Unity’s Documentation, so figuring something that isn’t documented well enough is tough for me.

Thank you for any response!

And : Unity - Scripting API: MonoBehaviour.OnTriggerStay(Collider)

Should give you all the info you need. For both first hits, or constant hits of collision