Sets the visibility of the given object.


object_set_visible( index, vis );

Argument Description
index The index of the object to change.
vis The new visibility of the object (true=visible, false=invisible).

Returns: N/A


With this function you can flag a specific object as being visible or not (for more information on the "visible" flag see Defining Objects). This means that all instances of this object that are created after visible has been changed will be created with this new state, while instances that are already in the room may not be affected.

Please note that this is not an instance function! You can set the visible flag of individual instances using the visible variable and so have ten instances all flagged as visible even though the object in question has the flag set to false in the IDE, and even if you change the visible flag of the object to true using this function, all instances that currently in the room will remain as they were, and only instances created after calling the function will start with visible flagged as true.


if !object_get_visible(obj_Block) object_set_visible(obj_Block, true);

The above code checks the visible flag of the object "obj_Block" and if it is false then it is changed to be flagged as true.

Back: Objects
Next: object_exists
© Copyright YoYo Games Ltd. 2018 All Rights Reserved