Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 mtGameDev · Aug 22, 2018 at 07:18 AM · ondrawgizmos

OnDrawGizmo when object is inactive ? (Editor)

is it possible to see OnDrawGizmo on inactive game objects ? in default, it only works on active or selected gameobjects.

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
0

Answer by Stratosome · Aug 22, 2018 at 08:39 AM

Heyo,

Alright, so I did some research. Here's what it's looking like. So, that OnDrawGizmo function is part of the Monobehaviour script that is on the object, right? That means when the game object is not active, the script isn't active, which also means this function won't be executing. So that's a problem. You'd need a way to get your gizmos / handles to be drawn some other way I think.


As for those other ways, I did some more research. You are able to bind events to Unity's SceneView.onSceneGUIDelegate (the link here may may be useful or not, dunno) which will draw things to the scene window without relying on a Monobehaviour. This might work, but it won't necessarily be drawing the gizmos that you had all made and planned in your OnDrawGizmos function. You'd have to make another thing to draw handles and such to the scene view. Another potentially problematic issue with this is that if you needed these Gizmos drawn for a specific object, I'm not quite sure how you'd give the function you bind to the above delegate this object (so that it can use it and such).


I also looked into using an Editor script based off a Monobehaviour script to see if I could manage to get something easy working there using the OnSceneGUI function, but that didn't seem to work. It was relying on the Monobehavior being active again.


CONCLUSION

So, I didn't quite manage to find something that would simply make your gizmos show up on a disabled object sadly. I wish it were easy but yeah. I figured I'd report my findings to you in case you may have been looking into this stuff. It is POSSIBLE that you could use the onSceneGUIDelegate and use some other editor script that is initialized using InitializeOnLoad. You could then bind a gizmo / handle drawing function to the delegate and then you would have to send all objects that you may want drawn to this script to hold on to and draw in the background. This would be tedious and a bit of work though... HOPEFULLY someone else can post a nice easy solution to this if one exists, but as far as I know, you can't nicely do what you're wanting.

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

88 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Constantly Update Scene View 1 Answer

Refresh OnDrawGizmos 1 Answer

Street Generation in Editor 0 Answers

Mouse click in edit mode. ✱✺✸❁ 1 Answer

Tried to call a Gizmos drawing method in OnDrawGizmos but got an error saying I can't call drawing methods outside of OnDrawGizmos... 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