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 /
  • Help Room /
This question was closed Feb 11, 2016 at 11:17 PM by DS4 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by DS4 · Feb 11, 2016 at 01:37 PM · color

give color to an object

Thank you for reading my question, probably a very dumb one, but I'm very new on Unity and can't find anywere this.

So i use Unity 5, and I have created an object, how can I give that object a color?

sorry for the dumbness :)

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 DS4 · Feb 11, 2016 at 01:44 PM 0
Share

I use this: GameObject[] list = GameObject.FindGameObjectsWithTag ("list"); foreach (GameObject aux in list) { *** GetComponent().material.color = Color.blue; }

but that does not produce anything, when I run the game, the same original dark gray of the cube appears.

*** in here if i put this ins$$anonymous$$d "GetComponent(aux).material.color = Color.blue;" does not compile.

2 Replies

  • Sort: 
avatar image
0

Answer by gorbit99 · Feb 11, 2016 at 05:21 PM

aux.getComponent().material.color = "putYourColorHere"

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 DS4 · Feb 11, 2016 at 06:10 PM

Didn't work. I put this "aux.GetComponent().material.color=Color.blue;" but i get this error "The type arguments for method 'UnityEngine.GameObject.GetComponent()' cannot be inferred from the usage. Try specifying the type arguments explicity".

can't figure it out what is wrong by that message.

Thank you for the help.

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 gorbit99 · Feb 11, 2016 at 07:10 PM 0
Share

first of all, in foreach loop: foreach (gameobject obj in list) obj.GetComponent().material.color = Color.blue;

avatar image DS4 · Feb 11, 2016 at 11:16 PM 0
Share

thank you for the help gorbit

Follow this Question

Answers Answers and Comments

41 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

Related Questions

How do I get my Buttons to switch colors? 0 Answers

Change button color to intermediate value on onclick() event 1 Answer

blocks coloring like in game The Stack? 1 Answer

material.color colors the GameObject only partially 1 Answer

Unity2D: Remove Shader Colour 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