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
1
Question by BHS · Mar 04, 2014 at 09:53 PM · editorwindowcustomname

How do you give a custom name to a editor window?

How do you give a custom name to a editor window? Written in C#

 // Add menu named "My Window" to the Window menu
     [MenuItem ("Custom Name Here")]
     static void Init () {
         // Get existing open window or if none, make a new one:
         MyWindow window = (MyWindow)EditorWindow.GetWindow (typeof (MyWindow));
     }
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
1
Best Answer

Answer by Jamora · Mar 04, 2014 at 09:59 PM

You set the title using the title property.

Comment
Add comment · Show 4 · 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 BHS · Mar 04, 2014 at 11:17 PM 0
Share

Thanks for the quick supply. I'm not familiar with the Editor Window program$$anonymous$$g. Could you supply an example? Unity doesn't supply one other than EditorWindow.title

avatar image Jamora · Mar 05, 2014 at 01:50 AM 0
Share
 // Add menu named "$$anonymous$$y Window" to the Window menu
 [$$anonymous$$enuItem ("Custom Name Here")]
 static void Init () {
     // Get existing open window or if none, make a new one:
     $$anonymous$$yWindow window = ($$anonymous$$yWindow)EditorWindow.GetWindow (typeof ($$anonymous$$yWindow));
     window.title = "Custom  Title"; // <---
 }
avatar image BHS · Mar 05, 2014 at 04:48 AM 0
Share

Thanks, but I'm encountering the same problem I had previously.

Ignoring menu item Custom Title because it is in no submenu!

How do I add a title without a submenu?

avatar image BHS · Mar 05, 2014 at 04:57 AM 0
Share

I found an example and this aloud me to do what I wanted.

Thanks for the help though.

 // C# example:
 using UnityEditor;
 using UnityEngine;
 public class $$anonymous$$enuTest : $$anonymous$$onoBehaviour {
     // Add a menu item named "Do Something" to $$anonymous$$y$$anonymous$$enu in the menu bar.
     [$$anonymous$$enuItem ("$$anonymous$$y$$anonymous$$enu/Do Something")]
     static void DoSomething () {
         Debug.Log ("Doing Something...");
     }
     // Validated menu item.
     // Add a menu item named "Log Selected Transform Name" to $$anonymous$$y$$anonymous$$enu in the menu bar.
     // We use a second function to validate the menu item
     // so it will only be enabled if we have a transform selected.
     [$$anonymous$$enuItem ("$$anonymous$$y$$anonymous$$enu/Log Selected Transform Name")]
     static void LogSelectedTransformName ()
     {
         Debug.Log ("Selected Transform is on " + Selection.activeTransform.gameObject.name + ".");
     }
     // Validate the menu item defined by the function above.
     // The menu item will be disabled if this function returns false.
     [$$anonymous$$enuItem ("$$anonymous$$y$$anonymous$$enu/Log Selected Transform Name", true)]
     static bool ValidateLogSelectedTransformName () {
         // Return false if no transform is selected.
         return Selection.activeTransform != null;
     }
     // Add a menu item named "Do Something with a Shortcut $$anonymous$$ey" to $$anonymous$$y$$anonymous$$enu in the menu bar
     // and give it a shortcut (ctrl-g on Windows, cmd-g on OS X).
     [$$anonymous$$enuItem ("$$anonymous$$y$$anonymous$$enu/Do Something with a Shortcut $$anonymous$$ey %g")]
     static void DoSomethingWithAShortcut$$anonymous$$ey () {
         Debug.Log ("Doing something with a Shortcut $$anonymous$$ey...");
     }
     // Add a menu item called "Double $$anonymous$$ass" to a Rigidbody's context menu.
     [$$anonymous$$enuItem ("CONTEXT/Rigidbody/Double $$anonymous$$ass")]
     static void Double$$anonymous$$ass ($$anonymous$$enuCommand command) {
         Rigidbody body = (Rigidbody)command.context;
         body.mass = body.mass * 2;
         Debug.Log ("Doubled Rigidbody's $$anonymous$$ass to " + body.mass + " from Context $$anonymous$$enu.");
     }
 }

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

21 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

Related Questions

Color custom editor window ? 2 Answers

Can a GameObject's full inspector be drawn in a custom Editor Window ? 1 Answer

Call inspector on custom window editor 4 Answers

Open new editor window from editor class 2 Answers

Draw inspector for SerializedObject within EditorWindow? 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