Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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
0
Question by Kusmi · Dec 28, 2012 at 09:31 PM · editorcallbackgizmoflag

DrawGizmo attribute: GizmoType arg with incompatible flag values

Hello there,

I try to use the `DrawGizmo` attribute to draw custom gizmos for my personal Unity editor tool.

The documentation about DrawGizmo is a bit sparse: I couldn't make the second DrawGizmo prototype work (`static function DrawGizmo (gizmo : GizmoType, drawnGizmoType : Type) : DrawGizmo`), so I'm using the first version of DrawGizmo but I've encountered some troubles about the values of the GizmoType argument.

In the C# example below, I've specifed the gizmo draw callback to be called when a Light game object is selected... but it appears to be executed whatever the object is selected or not! The GizmoType arg have sometimes all its flags enabled (`Active|NotSelected|Selected|SelectedOrChild`): how a game object can be active, selected and not selected at the same time?

 [DrawGizmo( GizmoType.Selected )]
 private static void RenderCustomLightGizmo( Light a_rLight, GizmoType a_eGizmoType )
 {
     Gizmos.DrawSphere( a_rLight.transform.position, 3.0f );
 
     if( ( a_eGizmoType & GizmoType.NotSelected ) != 0 )
     {
         Handles.Label( a_rLight.transform.position,
             a_rLight.name + " is selected but GizmoType says it is not. This message should not appear." );
     }
 }

Is it an Unity bug or am I doing/understanding something wrong?

Thanks.

PS: I was forgetting, I'm using Unity 3.5.7 on OSX 10.8.2

Comment
Add comment · Show 1
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 zadr · Mar 13, 2015 at 11:19 AM 0
Share

It seems that value of a_eGizmoType is multiplied by 2. I just submitted a bug report for this issue (Case 680232).

0 Replies

· Add your reply
  • Sort: 

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

Editor script - any callback when target is first instantiated? 1 Answer

Handles.matrix seems strange? 2 Answers

How to highlight a GameObject in the Scene view from an Inspector script? 1 Answer

Using the arrows of UnityEditor.UI for own inspectors 1 Answer

Why does this function, when called from OnDrawGizmosSelected, produce a different result and kill the editor? 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