Object reference

Hello, does anyone know if its possible to store object references in some type of way, so that you dont have to loop through a big group of objects to find the specific instance/object you’re looking for
Thanks in advance

Hey!
Unfortunately, I also struggle with this problem, and I’m not sure if there is a way around it.
Maybe someone else knows a way?

There are many ways. I’m not sure of your needs.

You can use object variables like selected. Set the variable to true for the selected object(s). Once picked by checking the boolean value, you could use for each instance if there are multiple objects.

You could link the objects to another object that was used strictly for the linking. Then pick the linked object(s) with take into account.

If you wanted to save the link, you would probably need to use object variables with IDs and place the IDs in an array or structure or save their position and repick using the X and Y.

none of these suggestions are ideal unfortunetlly, they still require you to loop through each object to find the one youre looking for

Are you talking about the scene editor or the event sheet or objects in a scene at runtime?

Can you give an example on what you want to do? How would it happen in an ideal way?

Keep in mind object instance lists populate via condition order of operations.

If you’re using the suggestions Keith mentioned above about Object ID variables or a Selected variable, and have it before any of the other conditions (and not in a for each), it will simply create an object list only if your object applies, rather than applying to all objects and then narrowing after the other conditions.

What I think Heqo means is: (Or at least this is what I want :smile: )
Instead of having to go “If variable = “Block1” then create object Block1”, "If variable = “Block2” create object “Block2”. Instead something like “Create object “variable””. Something like that.

1 Like

That sounds like create an object from its name.

2 Likes

what i mean exactly is, if i were to have 2000 objects and want to delete a object with a specific position, id want to be able to have a object with a reference to each of these 2000 objects and id concat the name + x +y as the key

You can pick objects by using point is inside x, y or check the X and Y seperatly. X=100,Y =100 as conditions. Or you could use your format with an object variable although, the values themselves already exist for each object so that would be redundant.

Conditions work like filters. Each condition modifies the picklist.

Are you talking about storing this information in a structure?

You could also give the objects column and row object variables so it would be 5,5 instead of say 150,150.

The Rectangular flood fill extension creates objects on a grid and automatically adds the column and row variables. It nice for creating a grid of tiles or a game board.