I’d now like to manipulate EditorApplication.currentScene to give me the folder for the scene because within each there is then an xml folder & the necessary xml file (as I’ve tried to show above).
Using currentScene I can get the string for my scene - C:\Users\markw\Documents\Project\Assets\MyScene\scene.unity
So how can I strip the scene file name (in C#)? I’ve not had to manipulate strings yet.
public static class StringExtensions
{
public static string SceneFolder(this string scenePath)
{
string[] pathParts = scenePath.Split('/');
if (pathParts.Length > 1)
{
string[] folderPath = new string[pathParts.Length - 1];
for (int i = 0; i < pathParts.Length - 1; i++)
folderPath _= pathParts*;*_
return String.Join(“/”, folderPath); }
return scenePath; } } It adds an extension method that will allow you to extract out the folder part of a Unity scene path. Then, you can get the scene folder like this: string myScenePath = EditorApplication.currentScene.SceneFolder();