What my project is doing is spawning in objects using instance_create_depth and then I'm checking to see which is which using a switch statement, I then transfer oBattleUIPopup to that unit's x and and y.
{
case 100010:
oBattleUIPopup.x = unit.x;
oBattleUIPopup.y = uiY;
break;
case 100011:
oBattleUIPopup.x = unit.x;
oBattleUIPopup.y = uiY;
break;
case 100012:
oBattleUIPopup.x = unit.x;
oBattleUIPopup.y = uiY;
break;
case 100013:
oBattleUIPopup.x = unit.x;
oBattleUIPopup.y = uiY;
break;
}```
This method has proven fickle and every time I add an object to a scene it breaks, because the id changes. So my question is what is a better way to track which object is which?