Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 LW · Jul 15, 2015 at 02:15 PM · selection

Set Selection.activeGameObject C#

Hi All,

I'm attempting to set a game object to be the UnityEditor.Selection.activeGameObject inside of the MonoBehaviour.OnDrawGizmos() method. It works for a frame and then immediately deselects the gameObject.

I have also tried Selection.activeTransform = transform and even copying the Selection.objects array and adding one more Object and reassigning it, to no avail.

Any insight?

Thanks,

Comment
Add comment · Show 2
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 _Morgenstern_ · Jun 24, 2016 at 10:09 PM 0
Share

I know this is an old question, but did you ever find a solution? I'm having the exact same issue now :)

avatar image jjeter · Aug 02, 2016 at 02:03 PM 0
Share

Could you tell us what Exactly you are trying to do with examples of code? In other words, how can we recreate this?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Fritsl · Sep 03, 2016 at 07:07 PM

Selection.activeGameObject is apparently only thought as a 'GET' from Unity Developers - There's also multiple issues with the two-rows project window when trying to use it as 'SET'.

I'm trying hard to convince them that there's a strong need to set it - so far no luck. (It CAN be used to set, but it's very buggy in actual use from EditorWindow)

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 giantkilleroverunity3d · Nov 22, 2018 at 07:39 PM -2
Share

$$anonymous$$y post of this issue has over 590 followers
$$anonymous$$ust be serious and hasn't got any serious Unity attention after one year?

I too have run into this loose anomaly. As in the post the VS compiles it but the Unity build fails. I have to agree with you that Unity needs to look at this. This seems to me to be a loose end or a non compliance somewhere in their system. Lets put this under NFT(Not Fully Tested) or TOTGA(The one that got away) category. It happens in large systems.

$$anonymous$$aybe after a year there is a fix...

avatar image Bunny83 giantkilleroverunity3d · Nov 22, 2018 at 11:23 PM 0
Share

This question here is completely unrelated to your question. You simply used it wrongly in a runtime script. The Selection class is an editor class and can only be used inside the editor. This question was about the fact that the assignment see$$anonymous$$gly had no effect when using it inside the Editor. However i can't really confirm or reproduce this issue here.

avatar image LW giantkilleroverunity3d · Nov 23, 2018 at 02:30 PM 0
Share

Hi @giantkilleroverunity3d I think @Bunny83 is correct about it being a different issue- although he probably could've used more tact.

I haven't had to deal with this issue in some years so I'm not even certain it exists any more.

avatar image giantkilleroverunity3d LW · Nov 24, 2018 at 05:43 AM 0
Share

I willfully and humbly accept the answer no matter what the tone. From my position I didn't understand how deep the question was as compared to how I inadvertently got there. Just the same, I now have a better understanding of what I actually did in lieu of what I thought I was accomplishing. I was using a previous PC game project and just trying to push it as is to the Oculus GO to test the headset with my code. I now know better. I have some more work to do. The previous project also has some FBX and $$anonymous$$ax files in it of which I will use Wings3d to redo the objs. That way I truly own my own work.

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

26 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

Related Questions

Level selection from main menu? 4 Answers

"add selected" editor script 1 Answer

Editor scripting, select a field 1 Answer

Selected object into next scene? 3 Answers

Selection Question 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