Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 NateJC · Jan 13, 2015 at 10:45 PM · editor-scriptingeditor extensionproject settingseditorscriptautomation

Change Unity Project Settings through Script

Briefly: Is there a way to change various Unity Project Settings (Edit > Project Settings > ...) via C# code?

Detailed: I created an editor extension that adds a custom File menu suite of tools that we us across our company projects. One of these items is used to initialize a project so it meets our company standards. Currently, this sets up a default folder structure and sets up all .gitignore files. Everything works great so far.

However, I would also like to manipulate Edit > Project Settings > PlayerSettings to populate the Company Name setting. And more importantly, I would like to manipulate Edit > Project Settings > Editor to make the project ready for git. Any suggestions?

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

1 Reply

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

Answer by skylem · Jan 13, 2015 at 10:56 PM

heres the docs on referencing Player Settings

judging from the documentation it should be a rather simple process something like

  compName = EditorGUILayout.TextField("Company Name:", compName);
 
 or 
 
   

  UnityEditor.PlayerSettings.companyName = "someBS";


Edit to include ur next question ---

 UnityEditor.EditorSettings.serializationMode = UnityEditor.SerializationMode.ForceText;
 
 appears to be the correct way to do this, enjoy.

Edit to Include documentation --- turns out its EditorManager

Edit to include Setting ExternalVersion --

 UnityEditor.EditorSettings.externalVersionControl = "Visible Meta Files";

Comment
Add comment · Show 8 · 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 NateJC · Jan 13, 2015 at 11:04 PM 0
Share

Good call with the UnityEditor.PlayerSettings.companyName = "someBS"; That does allow me to change the company name properly. But I can't find a similar option for the Edit > Project Settings > Editor section. Specifically, I want to change Asset Serialization to "Force Text".

avatar image skylem · Jan 13, 2015 at 11:17 PM 0
Share

changed my answer to include this, hope thats everything u needed.

avatar image NateJC · Jan 13, 2015 at 11:22 PM 0
Share

I don't know how I didn't find that earlier in my searching, but it's exactly what I wanted. Thanks for the great answer!

avatar image NateJC · Jan 13, 2015 at 11:28 PM 0
Share

Actually, I can't seem to find the documentation on EditorSettings. I did find it in the jp docs, but it doesn't actually mention EditorSettings.serialization$$anonymous$$ode and I don't seem to find it in the US docs at all. Where did you find the documentation on UnityEditor.EditorSettings.serialization$$anonymous$$ode?

avatar image skylem · Jan 13, 2015 at 11:36 PM 0
Share

I was actually unable to find the documentation on EditorSettings, i worked it out by blindly experimenting with lines in C# until it gave me the values i was looking for ill have a look through the documentation and be back soon.

Show more comments

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

27 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is there a way to get all editable fields of a component in a script? 2 Answers

Run method of editor script when application is playing 1 Answer

Play Unity Editor from VSCode? 0 Answers

Dynamic content in custom EditorWindow 1 Answer

Can Unity Editor enter PlayMode without reloading a script 1 Answer


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