With this function you can create a path in GameMaker Studio 2 without using the path editor. this function will return the index of the path which should be stored in a variable and used as the reference for that path from then on. Please note that the created path is empty ie: it has no points defined, so you will then have to use the other available functions to add points to the path or be using mp_grids to generate the path. Once you have finished using the path, or wish to create a new one and store its index in the same variable you should first delete the old path with path_delete to prevent memory leaks which can eventually crash your game.






global.newpath = path_add();

This will create a new path and assign its index to global.newpath.