How can I check if a specific gameObject is located in a specific "room"?

Hello Unity community, first time poster here. Here’s my issue: I am attempting to store, track and compare the location of many gameObjects within a scene and ultimately compare their location against a set of criteria.


A VCR game object is located in room A and the player picks up the VCR and moves it to room B. I would like to know how to compare the location of the VCR from its original position to its final position.

What I’ve tried (or attempted to try)

I’ve attempted to use gameobject.transform to get the x,y, and z position and compare that to the final position but that only resulted in me knowing it moved, but not to where (room)

***Ultimately what I’d like to do is to say to the player, get item A from room A and move it to room B. Then I’d like to check to see if they have completed the task.

Any help would be greatly appreciated!

I guess your rooms are not arranged like a grid. You can use trigger volumes and react to TriggerEnter to know if the player enters a specific room.

leepkits answer is very exeptable!

Alternatively you can always see if you’re withing a box shape simply with 4 greater than/less than statements. a simple example would be:

if (transform.position.x>5f){     //left limit of room
if (transform.position.x<15f){   //right limit of room
if (transform.position.z>6f){     //back limit of room
if (transform.position.z<20f){   //forward limit of room

print("i am in the room");