• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

instance_place not working the same (or has bug) in new version?

BoB3k

Member
I've had a bug pop up and couldn't see anything I did to cause it, so I went back to the last version and it was gone. So, it looks like it is because of the new GMS2 version.

Bug:
instance_place() wasn't working (as in return -4 even though it should be finding an object) in the very specific circumstance of 1) when I went into a new room (using goto_room()) from the original room and call instance_place for an object that 2) did NOT appear anywhere in the original loaded room. -- that's right, if you have an object that DID appear in the original room, it will be detected. only objects not yet ever instantiated are missed.

So, I reinstalled the old version and it worked again.

I put in debug prints, and they confirm i'm getting -4s with the new version and valid instance ids with the old version.
Working version: GameMakerStudio-Installer-2.2.0.343 (runtime 2.2.1.287 and 2.2.1.291)
NOT working ver: GameMakerStudio-Installer-2.2.1.375 (runtime 2.2.0.258)


Does anyone know why this would be happening on purpose as not a bug? Has anyone else had any instance_place() errors in the new code?

Thanks,

BoB
 

FuRyvok

Member
The instance_place checks for collision with an object

Code:
var inst;
inst = instance_place(x, y, obj_Enemy);
if inst != noone
{
//Do something if there are collision with obj_enemy
}
Code:
room_goto();
 

Relic

Member
Is the room_goto() in the same event as instance_place()? I believe the entire event has to finish before things like a cleanup event/destroy event (and maybe a room change) will occur. You may say go to the new room but are still in the old room until the next step. Why that works in one version and not the other is weird though.
 

BoB3k

Member
Is the room_goto() in the same event as instance_place()? I believe the entire event has to finish before things like a cleanup event/destroy event (and maybe a room change) will occur. You may say go to the new room but are still in the old room until the next step. Why that works in one version and not the other is weird though.
No, nothing that timing would effect. Once I'm in the new room, none of the objects will come back from the instance_place.
 
Top