A macro creating a new object reference with singleton functionality. This means any reference to the object (using the macro) will create an instance of the object if it does not already exist.
/// Singleton
/*
Place this in the create event of the object.
Make sure to name the object itself as you
normally would, except prefixed with a "_".
Replace "obj_example" in the macro with the
object name (without the "_"). Adjust the
instance_create_depth to your liking.
*/
#macro obj_example (instance_exists(_obj_example) ? _obj_example : instance_create_depth(0, 0, -10000, _obj_example))