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 /
avatar image
0
Question by poncho4242 · Dec 01, 2015 at 10:38 AM · c#shaderemission

InternalErrorShader

When I test my game I get a Non-working shader that doesn't serve the intended function which is to change the Emission Color of my troll from black to white. I want to modify the script to change the color over time eventually. Does anyone know why I'm getting this error, or how to write a better C# script that will change the emission color of my troll?

I

screen-shot-2015-11-30-at-95635-pm.png (192.3 kB)
screen-shot-2015-11-30-at-95544-pm.jpg (325.6 kB)
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 fffMalzbier · Dec 01, 2015 at 10:37 AM 0
Share

Can you post the error you get and the code? (Preferably with the code tags) That way we can test your code way faster.

avatar image poncho4242 fffMalzbier · Dec 02, 2015 at 09:10 PM 0
Share

Its in the picture above. I start with just my "overlay" shader, but when I run the game a new shader "overlay (Inheritance)" appears with the dropdown that reads "Hidden/InternalErrorShader" and makes my troll look like a pink mass.

I'm trying to program the emission to change from the dark one to the white one, in the picture below, in game. $$anonymous$$y goal is to make it change from black to white based on its health, but in this script I'm just trying to change the emission at the start, because, frankly, I'm not sure how to write a proper script that can change an objects emission.

alt text http://answers.unity3d.com/storage/temp/59153-screen-shot-2015-12-01-at-22539-pm.png alt text screen-shot-2015-12-01-at-22539-pm.png (50.9 kB) screen-shot-2015-12-01-at-22523-pm.png (32.2 kB)

avatar image Jessespike · Dec 02, 2015 at 09:34 PM 0
Share

is "overlay" the material name or the shader name? Looks like a material named overlay using a Standard shader.

What happens if you remove the line:

 troll.material.shader = Shader.Find("overlay");

avatar image poncho4242 Jessespike · Dec 02, 2015 at 10:24 PM 0
Share

If I remove the line, the troll stays its normal dark presence without switching to white. I also tried replacing "overlay" with "Emission" and "EmissionColor." Both of those produce the result as before where the troll turns pink and the Emission Color doesn't change.

1 Reply

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

Answer by Jessespike · Dec 02, 2015 at 10:59 PM

I think there's some confusion with your names and strings. Replacing "overlay" with "Emission" won't work. I think overlay is your material name, but you're trying to use it as a shader name. And using Properties as a shader name won't work. Here's a simple test that worked for me:

 Material mat = GetComponent<Renderer>().material;
 Color newColor = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f));
 mat.SetColor("_EmissionColor", newColor);
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 poncho4242 · Dec 03, 2015 at 01:08 AM 0
Share

Huzzah! That was the coding I needed. Thank you!

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Fade emission color using standard shader 1 Answer

How do I paint the part of a model that is embedded in another model?, 0 Answers

Having trouble to getting the height from an object being displaced by a shader 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