• 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.

Windows [Help] Global persistent instance across rooms (not Object , but only particular instance of same object)

weisinx7

Member
Hi Guys,

I tried to create persistent instance from certain object and store it in global variables, so that i can access it across rooms. I deactivated the instance each time i created it. So when i changed room, looks like i'm facing issue to find the instance. Here the snippet of the code:

ds_list_add(global.player_list,instance_create_depth(0, 0, 999, object));

global.player_list[|(ds_list_size(global.player_list)-1)].persistent = true;

instance_deactivate_object(global.player_list[|ds_list_size(global.player_list)-1]);

When i changed room and try to access object parameter in global.player_list, i'm facing error (unable to find instance with object index ...) . This is how i access the object parameter:

global.player_list[|0].parameter

Any idea?
Thanks in advance.
 

FrostyCat

Redemption Seeker
This looks like something you should be using structs for, not object instances.

It disheartens me that so many people still insist on using GMS 2.3 as though it is still GMS 1.0.
 

weisinx7

Member
i see, looks like struct is more suitable then. But what do you mean by " so many people still insist on using GMS 2.3 as though it is still GMS 1.0. "?
 
Top