Accessing Path Based-off Path Layer's Name

blexc

Member
Hi,

I have a path layer called "CameraPath". For each level of my game, there is a unique path that the camera will take to introduce the level. Here's a screenshot demonstrating this:

1619301400224.png

Given that the paths are different for each level but the path layer's name is the same, it would be really convenient if I could simply search for the path based off the layer's name. For example, like:

GML:
layer_get_path(layer_get_id("CameraPath"));
Unfortunately, it seems this sort of functionality doesn't exist. I'm curious what you guys think of as a work-around. Thanks.
 

TsukaYuriko

☄️
Forum Staff
Moderator
I don't think path layers are supposed to make the path accessible in-game. They're meant as a way to edit a path using a room as the background for reference. I'm not aware of a way to retrieve the path referenced by a path layer (the absence of a "path" in the layerelementtype group agrees with this). If you'd like to see this added as a feature, though, please file a ticket.

As a workaround, I'd suggest assigning the path to be used to the instance that controls the level preview camera panning via its instance creation code.
 

blexc

Member
Yea, I'll probably end up giving the camera each path name for each level. I'll add a ticket though. Thank you.
 
Have you tried having a generic path that gets overwritten each room(?), and use a combinaison of asset_get_index and path_assign to hack the rest?
I don't know how comfortable you are with GML, so feel free to tell me if this sounds like chinese.
 
Top