• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Discussion Persistent Object Inconsistencies

A

Ariak

Guest
Hey,

did anybody else run into any problems with persistent objects switching rooms? In my levels I have several objects that in their create event reference my persistent controller object "cont_main". In GMS1.4x i had no issues whatsoever. The persistent object was guaranteed to be the first instance in the new room and all following objects could go ahead with their create event without any problems.

I created a little room_init object which flushes texture pages, sets up the camera and moves my controller objects into the designated room controller layer of the new room. This is because otherwise the persistent object will remain in its "old layer" from the other room, but there is no way to ever reference it (layer shows as -1);

I keep on getting errors where the create event of my room_init object (placed in the room editor) runs before the persistent controller object has switched rooms. I've never encountered a similar problem in GMS1.4.

I've already worked around this by setting up default values etc should the controller object not exist when executing a room switch + subsequent create event in the new room. However now the other instances throw errors as they cannot find the main controller object in the create events.

Unfortunately i can't replicate the problem 100%, it seems to be down to chance! YYC+VM.

Edit:

Please Ignore: My controller object was being deactivated - thus destroying itself upon room switch, regardless of persistence.
 
Last edited by a moderator:
Top