sync object color variable

Posted by jose_creative
hi i wonder how do i sync a color variable (like make_colour_rgb() ) for an object
im trying to make a brick building game but when it "syncs" the vaiable the brik it's just full black and it doesn't change!

Replies (3)

Last message on 26 Jul 2021

Size43 (Administrator) on 16 Jul 2021, 22:14:17
Apologies for the delay. A color is just a number in GameMaker, so you should just be able to use gms_self_set and gms_other_get to sync the variable (for player variables), or gms_instance_sync_var_add/gms_instance_set/gms_instance_get (for instance syncing). Could you post the code that you're using to sync the variable?
jose_creative (Topicstarter) on 17 Jul 2021, 20:32:27
here is the code:
BrickColor = global.BrickColor
Size43 (Administrator) on 26 Jul 2021, 19:03:11
All calls to gms_instance_sync_var_add must appear before the call to gms_instance_sync. Swapping those two calls should make your code work. (assuming you also have the corresponding code in the user defined event to load the value again)