You are currently viewing the GMLscripts.com static mirror. Forum access and script submissions are not available through this mirror.

Invert GMLscripts.com

instance_singleton

Returns a single instance of the given object, creating one if no instance exists.

A = instance_singleton(object);  //  An instance of object is created.
B = instance_singleton(object);  //  The first instance is returned; A and B are equal.
instance_singleton(object)
Returns a single instance of the given object, creating one if no instance exists.
COPY/// instance_singleton(object)
//
//  Returns a single instance of the given object, 
//  creating one if no instance exists.
//
//      object      object to look for, real
//
/// GMLscripts.com/license
{
    var obj = argument0;
    if (instance_number(obj) == 0) return instance_create(0, 0, obj);
    return instance_find(obj, 0);
}

Contributors: RaniSputnik

GitHub: View · Commits · Blame · Raw