Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Bill · May 06, 2010 at 09:29 PM · editoreditor-scriptingproject

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

5 Replies

· Add your reply
  • Sort: 
avatar image
5
Best Answer

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bill · May 07, 2010 at 04:52 PM 1
Share

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.

avatar image
6

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;
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
3

Answer by Tomas1856 · Sep 26, 2013 at 03:00 PM

PlayerSettings.productName might also return what you want.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Xtro · Jul 23, 2014 at 08:05 PM 1
Share

This only works in editor.

avatar image Tortuap · Oct 18, 2018 at 09:27 AM 1
Share

Project Name & Product Name aren't the same thing.

avatar image
-1

Answer by Cuttlas-U · Oct 10, 2018 at 08:46 AM

use: Application.PruductName;

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Tortuap · Oct 18, 2018 at 09:28 AM 0
Share

Project Name & Product Name aren't the same thing.

avatar image
0

Answer by c8theino · 5 hours ago

I was trying to find an unique identifier for project and many google search results ended up to this thread. If anyone else is looking for a unique unchanging identifier for projects, this seems to do the trick: PlayerSettings.productGUID

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Editor scripting - How to show the Assets menu as a context menu 1 Answer

Undo.RecordObject isn't working. 7 Answers

Can you run custom code when changing scene perspective? 1 Answer

How to change a selection effect in editor 0 Answers

Some Text crash after few force closing of Unity Editor 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges