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
0
Question by OperationDogBird · Aug 14, 2012 at 04:23 AM · editorselectionpopupfield

Editor scripting, select a field

Hi, im making my first editor script. I want to make an my fields selectable, and when it is active i want a pop up window to show up.

Ive been trying to use Selection.activeGameObject like so

 for(com in target.gameObjectsToModify)
 {
     com=EditorGUILayout.ObjectField(com,GameObject,false,options);
 
     if(Selection.activeGameObject==com)//Create popup
 }

This doesnt work, as i tried printing from the if statement. What is the proper way to get the selection of the field?

I made another script that extends EditorWindow for the pop up. Currently the popup never shows up ( im not using any conditionals currently). Lets say it does work, how can i link it to that if statement and create that popup when the field is selected?

Comment
Add comment · Show 3
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 Paulo-Henrique025 · Aug 14, 2012 at 06:56 PM 0
Share

You want that if you select a gameObject that is listed a popup appears?

avatar image ScroodgeM · Aug 14, 2012 at 07:07 PM 0
Share

r u talking about Editor or EditorWindow?

avatar image OperationDogBird · Aug 14, 2012 at 07:17 PM 0
Share

I want it so when you click the Object field the popup appears (the object field lists all my modifiable gameobjects).

@Scroodge$$anonymous$$ The code i have above is an Editor script, im not sure how to make the popup in the Editor script, so i made a seperate EditorWindow script. This is probly not the way to go about it...but im really unsure how to do what i proposed.

1 Reply

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

Answer by ScroodgeM · Aug 14, 2012 at 08:31 PM

Editor script executes only when object that this editor is created for is becomes selected

so, you should use EditorWindow to monitor selection changing using

http://docs.unity3d.com/Documentation/ScriptReference/EditorWindow.OnSelectionChange.html

and make whatever you want in this method.

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 OperationDogBird · Aug 14, 2012 at 09:13 PM 0
Share

Ok, thats what i was looking for. Hopefully i can integrate it with my Editor script. Thanks

avatar image OperationDogBird · Aug 14, 2012 at 10:03 PM 0
Share

@Scroodge Tho only probly with this is that you need to click the actual object. I want to click the Field and have the window popup.

avatar image ScroodgeM · Aug 15, 2012 at 09:26 PM 0
Share

what's the problem though? if you need field me clickable just use button with field style, then it will look like a field but can be clickable...

avatar image OperationDogBird · Aug 16, 2012 at 03:27 AM 0
Share

@Scroodge$$anonymous$$ Oh i was unaware of that solution. Ok that helps me a ton, thank you! Sorry for my ignorance in this realm, first editor/editorWindow scripts. I appreciate the help a bunch. Thanks again.

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

9 People are following this question.

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

Related Questions

How can I define two-dimensional curves? (like: circle) 1 Answer

Custom EditorGUI Problem 0 Answers

How to show an Editor Window based upon Selection 1 Answer

Spline Editor: Maintain object selection and object attachments 0 Answers

Settting Selection.activeObject to multiple items 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