• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[SOLVED] finding instance id without knowing it's position

Hey hi,

my question is pretty straight forward: how would I go about if I wanted to access a certain instance without knowing its position?

For example, I try to create a level selection screen. One obj_level represents a level and between some of those, there are connections. Just like draw_line (obj_level.x, ... another obj_level.x).
But because I want to be able to edit the overall map and position of levels in the level editor and not do everything by hand I think I need to find the instance and then its position dynamically.

In Unity you can just do a public variable and then drag the instances you need access to into a editor field. There has to be a normal workflow to achieve something technically similar in Game Maker but I really cant think of anything...

Thank you so much for your help!
 

FrostyCat

Redemption Seeker
See: The Room Editor > Layers > Instance Layer
The Manual said:
By default the instance will have a name like "inst_38B0BFF", but this can be changed to anything you want as long as the name uses only alpha-numeric characters and the under-bar "_" (and no spaces). However it's worth noting that the name given here (whether one you give, or the default one that the IDE gives) is considered a constant and so must be unique to the instance. This also means that it can be used in code n your game to identify the instance, but only if you are in the same room as the instance.
 
Top