LEGOlars
Member
Hi,
Can someone explain why: When instance_exists() returns true, this doesn't mean that the create event for that instance has been executed?
Example:
if I have a room with the following creation order:
1. objHello
2. objBye
When I check instance_exists(objBye); in the create event for objHello, it returns true. But when I then try to read variables from objBye, it will throw a fatal error, because the create event only executes for objBye after the create event for objHello has finished executing. Is there any good reason why instance_exists shouldn't just return false in this case?
What I expect:
I expect the way that rooms spawn instances is consistent with how you would spawn it in code.
Similar to eg. using the creation code in the room editor to spawn the instances.
In this case, it would check whether objBye exists, but it has not been created yet. So it would return false.
Can someone explain why: When instance_exists() returns true, this doesn't mean that the create event for that instance has been executed?
Example:
if I have a room with the following creation order:
1. objHello
2. objBye
When I check instance_exists(objBye); in the create event for objHello, it returns true. But when I then try to read variables from objBye, it will throw a fatal error, because the create event only executes for objBye after the create event for objHello has finished executing. Is there any good reason why instance_exists shouldn't just return false in this case?
What I expect:
I expect the way that rooms spawn instances is consistent with how you would spawn it in code.
Similar to eg. using the creation code in the room editor to spawn the instances.
GML:
var lay_id = layer_get_id("Instances");
instance_create_layer(x,y,lay_id, objHello);
instance_create_layer(x,y,lay_id, objBye);