- Home /
Retrieving Project Name
Is there something similar to "EditorApplication.currentScene" for the currently opened project? I'm doing some batch processing of the project and would like to grab it's name. Seems like there should be something in the API to easily do this already, but I can't seem to find it.
Answer by Cyclops · May 06, 2010 at 10:03 PM
You can use the Application class to find the directory name where your Project Assets are stored - then cut up the path. That's the closest I know. Sample JS code would be:
function Start() {
var dp : String = Application.dataPath;
var s : Array;
s = dp.Split("/"[0]);
Debug.Log("project = " + s[s.length - 2]);
}
So if your Project Assets was in: C:\Current Projects\Labs\01 Box Demo\Assets, the output would be project = 01 Box Demo.
That is pretty much what I assumed I would have to do. Thought maybe they would have stored the actual project name somewhere... oh well.
Answer by neoRiley · Jun 21, 2013 at 03:16 PM
Just for the C# crowd:
public string GetProjectName()
{
string[] s = Application.dataPath.Split('/');
string projectName = s[s.Length - 2];
Debug.Log("project = " + projectName);
return projectName;
}
Answer by Tomas1856 · Sep 26, 2013 at 03:00 PM
PlayerSettings.productName might also return what you want.
Your answer
Follow this Question
Related Questions
Editor scripting - How to show the Assets menu as a context menu 1 Answer
particle system curves bug? 3 Answers
What hooks exist for modifying and drawing in the animator window? 0 Answers
Storing a list when application Quits 0 Answers
Render overlay in editor like the NavMesh Display option 'Show NavMesh' 0 Answers