x


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.

more ▼

asked May 06 '10 at 09:29 PM

Bill gravatar image

Bill
311 20 24 36

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered May 06 '10 at 10:03 PM

Cyclops gravatar image

Cyclops
7.1k 33 63 115

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.

May 07 '10 at 04:52 PM Bill
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1670
x348
x268

asked: May 06 '10 at 09:29 PM

Seen: 1218 times

Last Updated: May 06 '10 at 09:29 PM