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
3
Question by BHS · Feb 29, 2012 at 06:12 AM · materialcolorchangesetcolorvertexlit

Is it possiable to change the Emissive Color on VertexLit Blended Material with a script?

I'm using java and have been at this for hours and it should be as simple as the below code but it doesn't work. I can get the other materials to work, but not the VertexLit Blended Material.

Is this even possible? I'm begging to think it's not, which would be a let down as it looks so good for the script I'm writing..

Is there another way to do this? I have looked through all the documentation. I have tried both function start and update. I also have @script ExecuteInEditMode() so that everything it in real time.

 renderer.Material.SetColor ("_Emission", globalFogColor);
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
7
Best Answer

Answer by Radazen · Mar 13, 2012 at 05:47 AM

Despite what the docs say about "_Emission" being the name of the emissive property of a shader, the name is actually defined in the shader itself and can be something else. If you download the source for the built-in shaders and look at the Particle VertexLit Blended shader, you can see that the property is actually called "_EmisColor" there, and using that with renderer.Material.SetColor should work.

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 RFLG · Oct 05, 2012 at 01:49 AM 0
Share

Saved my life with your answer! Thanks! I'd +1 it, but the website won't let me :P

avatar image XcentY · Oct 04, 2014 at 12:33 AM 1
Share

You don't even have to download the shader source. Just click "edit" button in the inspector next to the shader name and it will give you a list of all properties with their name.

avatar image darkAbacus247 · Jul 24, 2015 at 12:07 AM 0
Share

"You don't even have to download the shader source. Just click "edit"

...ya know, sometimes things are just obvious. Can't believe this has been here all this time.

Thanks for the post! Saves me a bit of headache

avatar image siddharth3322 · Jan 01, 2019 at 09:19 AM 0
Share

"_EmisColor" is worked for me properly.

"_EmissionColor" is not working in Unity 2017 version.

avatar image
1

Answer by Javier_8 · May 02, 2015 at 03:10 PM

material.SetColor ("_EmissionColor", myColor);

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 srmojuze · May 18, 2015 at 09:53 AM

As of Unity 5.0 1f1, for the STANDARD shader, the proper syntax is Javier_8's, for example: GetComponent().material.SetColor ("_EmissionColor", Color.red); Cheers!

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Changing two different objects renderer colour 1 Answer

Material doesn't have a color property '_Color' 4 Answers

Changing a second objects material on trigger 0 Answers

Change 'Color Mask' Property At Runtime 1 Answer

Setting color information and passing it in scenes 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