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 MDarkwing · Feb 09, 2015 at 04:20 PM · uiguiimage

What is the name of .color propert for new Unity UI Image?

Before new UI I've been creating my own UI using SpiteRenderer and sprites and have used GoKit to tween color, size and other stuff of the UI. Since I've finished old project I've decided to start using new UI on next project and I'm having difficulties to get the name of the color property so i can pass it to .colorProp of the GoTweenConfig() of GoKit. I've tried to see the declaration of the Image class but I can't seem to find Color property anywhere there.

How can i get what is the name of that property variable?

Thank you in advance!

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

3 Replies

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

Answer by saschandroid · Feb 09, 2015 at 04:26 PM

 GetComponent<UnityEngine.UI.Image>().color
Comment
Add comment · Show 2 · 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 MDarkwing · Feb 09, 2015 at 04:32 PM 0
Share

I think you haven't used the Go$$anonymous$$it. I need the actual name of the variable like in renderer component name of the color is something like _Color. The method takes name of the variable and then concludes what type is it, but I cant seem to find the declared color property in the Image class. I know i can get component or put a reference of the actual image.

avatar image MDarkwing · Feb 10, 2015 at 10:47 AM 0
Share

I found out yesterday that the name of the color parameter is "color". And yes you need to pass image component, I've already had public field in my script for referencing it.

thanx anyway

avatar image
1

Answer by Hohusen · Feb 09, 2015 at 11:35 PM

Hey, Darkwing. I had the same problem earlier today. You need to pass the uGUI Image to the tween.

 Image uiImage = gameObject.GetComponent<Image>();
     
 GoTweenConfig colorConfig = new GoTweenConfig().colorProp( "color", new Vector4( 1, 0, 0, 1) ).setEaseType(GoEaseType.SineIn);
 GoTween colorTween = new GoTween(uiImage, 1.0f, colorConfig);
     
 Go.addTween( colorTween );

Make sure you've imported UI scripts via using UnityEngine.UI; at the top of your class.

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 DanSuperGP · Feb 09, 2015 at 11:32 PM

It inherits it from **http://docs.unity3d.com/460/Documentation/ScriptReference/UI.Graphic.html**

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

22 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

Related Questions

How should I generate an image of a model? 1 Answer

Matching the size of UI elements with that of world objects 0 Answers

GUI looks Awful! 0 Answers

Fuzzy/Blurred Texture2D OnGUI problem 1 Answer

Change slection grid content texture size/scale 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