In GameMaker Studio 2 you have objects and you have instances. Objects are essentially the base template for an instance, and as such are never present in a room directly... only instances of the object are placed in the room. This means that if you want to change something for all instances you are going to create, then you can do it by changing the object.
You can also access information about a base object and use it to dictate behaviours or changes in the game. For example, you can do a check for a parent object ID, and in the following code if an instance with that parent is found you can then check its object_index to decide what should be done.
GameMaker Studio 2 gives you a number of functions that permit you to get various details about an object. Note, an object is not an instance (an in-game entity), it is purely a resource from which all instances are created. This means that the return values of these functions may be different to the actual values shown by instances in the room, as once an instance is created it can be changed through code and DnD™ actions.
There are also a number of functions that permit you set the properties for an object. It should be noted that any instances of this object that already exist in the room may not be affected by these functions, but all new instances of this object created in the room will be, so it is recommend that you never change an objects properties when instances of that object are present in the current room.
You can also use certain functions to generate events from code from within a specific instance or object. These functions can be very useful, especially when dealing with Parents and Children, and are outlined in the following section:
- Generating Events