variable_instance_names_count

This function returns the total number of variables defined for an instance.

You supply the instance ID to check, and the function will return an integer value for the number of variables encountered, or (in case no instance of the given ID exists) -1.

 

Syntax:

variable_instance_names_count(instance_id);

Argument Type Description
instance_id Object Instance The unique ID value of the instance to check.

 

Returns:

Real (the number of variables or -1 if invalid instance ID)

 

Example:

ins_player = instance_create_depth(0, 0, 0, obj_player);
var _num = variable_instance_names_count(ins_player);
show_debug_message($"The player instance has {_num} variables.");

The above code will retrieve the number of variables in the given instance and show a debug message in the console output with that value.