path_index


Description

All resources in GameMaker Studio 2 have a unique identifying value, and the path_index is a read-only variable that holds the index value for a given path resource. If the instance has no path assigned, the variable will be set to -1.

For functions relating to paths, see here.


Syntax:

path_index;


Returns:

Real (Resource index value)


Example:

if path_index = -1
   {
   path_start(pth_enemy3, 4, path_action_reverse, 0);
   }

The above code checks to see if a path has been assigned to the instance, and if not it starts a new path (assigning it to the path_index at the same time).