Instance variable not recognized by a different instance
I have two objects, let's say 'define' and 'setup'. Both 'define' and 'setup' are in the room and 'define' comes first.
In obj 'define' I declare this instance variable copper = 1;
In obj 'setup' I try and add the copper to a ds list.
global.deck = ds_list_create();
ds_list_add(global.deck, obj_define.copper);
I get this error when i try to run the program
Variable obj_define.<unknown variable>(100400, -2147483648) not set before reading it.
at gml_Object_obj_setup_Create_0 (line 27) - ds_list_add(global.deck,
obj_define.copper);
Posted Sep 17, 2020, 6:39 AM UTC
15
This works for me. Did you try to recreate it in an empty poject? The only thing that I can think of is if you have defined copper as a local variable:
instead of:
Its like the second example you gave. It does work in an empty project, but in my current project I disabled all the objects except these two and that didn't fix it.
Can't say for sure what's going on, try recreating the room, starting from those 2 objects only.