Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 mostlyhuman · Jan 06, 2017 at 08:47 PM · editor-scriptingcolorgizmos

Gizmo wont change color in certain project

I created a gizmo script that has a public color variable then in the ondrawgizmos I set the color to that variable. The intention is to have a color picker in the inspector to change the gizmo color. For some reason this does not work in my current project, I can set the gizmo color in my script to an exact color using Color.yellow etc and it will work. The weird thing is if I create a new empty project using the exact same script it works just fine, just not in the project I already have in progress. Any ideas on why this may be?

      public class CubeGizmo : MonoBehaviour
      {
         public Vector3 centerOffset = new Vector3(0, 0, 0);
         public Vector3 cubeSize = new Vector3(1.0f, 1.0f, 1.0f);
         public Color color;
      
         Vector3 origin;
         
         public void OnDrawGizmosSelected()
         {
            Gizmos.color = color;
            origin = transform.position + centerOffset;
            Gizmos.DrawCube(origin, cubeSize);
         }
      }
Comment
Add comment · Show 4
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 Adam-Mechtley · Jan 08, 2017 at 09:34 AM 0
Share

Can you share the code where the change to Gizmos.color is applied?

avatar image Adam-Mechtley Adam-Mechtley · Jan 08, 2017 at 09:55 AM 0
Share

When this is not working, what color is it using? Just white?

avatar image mostlyhuman Adam-Mechtley · Jan 08, 2017 at 09:56 AM 0
Share

It will default to black in the editor and so will appear invisible for in the editor. I can then select different colors but it doesnt detect the color change at all. And again it is so strange if I put this exact same script in a new project it works just fine, i dont understand what is preventing it from working in my current project.

Show more comments

3 Replies

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

Answer by Adam-Mechtley · Jan 08, 2017 at 10:43 AM

In your comments above you stated

It will default to black in the editor and so will appear invisible for in the editor.

Do you mean it is just showing nothing in the scene then? The default value for a color field with no initialized value is (0, 0, 0, 0), which is of course transparent. Can you verify you have also set a non-zero alpha value when you use the color picker?

Comment
Add comment · Show 1 · 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 mostlyhuman · Jan 08, 2017 at 10:48 AM 1
Share

oh wow, yah the alpha was all the way down, so strange that it was defaulting to all the way up when I would bring that same script into a new project, any ideas why it would do that? Thank you again for your help!!! :)

avatar image
1

Answer by mostlyhuman · Jan 08, 2017 at 10:24 AM

I guess we ran out of reply space, so I hadnt actually but I just now set it from black to red and when debugging it still shows black is assigned. [edit] actually red was assigned but red was not reflecting in the scene view of course.

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

Answer by DeepDeepWoe · Feb 21 at 02:16 AM

I'm having the same issue. Did you fix it?

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

69 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

Related Questions

Set Gizmo colors to multiple Gizmos 1 Answer

How can I use a GUIStyle in a Custom Editor which is set within that Custom Editor? 1 Answer

Custom asset icons changed after upgrade to Unity 2017.2 0 Answers

How do I select gizmos by mouse clicking in the editor? 1 Answer

Handles.PositionHandle not working anymore in version 2019.3? 0 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