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
3
Question by Malek-Bakeer · May 23, 2018 at 02:11 PM · shadershaderscolorgraphmissingfieldexception

Shader Graph Edit Parameters From Script

Hello,


I have made a simple shader graph that has an inline effect and i need it to have alpha transparency to edit it by code, however everything is working in the inspector but in code when i call material.color it gives me an error saying "Material doesn't have a color property '_Color'" and if i call material.SetFloat(string name, float value) it just does not affect anything.


Note:

  • the float name is "Alpha"

  • the color name is "Color"

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 kigro · Jun 03, 2018 at 12:37 PM 0
Share

In my case I can acces material.color, but it doesn't change anything, and SetFloat(), SetColor(), etc also doesn't work. Have you managed to find whats wrong?

5 Replies

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

Answer by davidcox70 · Jun 03, 2018 at 01:37 PM

You're on the right lines, but the name you need to target is different for shader graph generated shaders. In the inspector for your object, click the cog icon next to the material and choose "select shader". You'll get an inspector like this:

alt text



The name you need to target are the ones down below, such as "Vector3_895C57D6", created by Unity.

DC


shadernames.png (21.0 kB)
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 farah-abdelhakim · Nov 19, 2019 at 02:12 PM 0
Share

@ davidcox70 thank you that was helpfull

avatar image
4

Answer by Tarrag · May 23, 2019 at 09:45 AM

or change here within shader graph https://blogs.unity3d.com/2018/07/10/2018-2-is-now-available/#property

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
3

Answer by frankadoriv · Sep 05, 2018 at 08:20 AM

"The name you need to target are the ones down below, such as "Vector3_895C57D6", created by Unity."

This is a joke right?

C'mon unity team, WTH?

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 asimdeyaf · Oct 13, 2018 at 04:04 AM 0
Share

It ain't so bad. You can edit the name to something more sensible in the Shader Graph. So your code should look something like this: $$anonymous$$y$$anonymous$$aterial.SetColor("_$$anonymous$$yColor", Color.red);

avatar image
1

Answer by Jason-Michael · May 08, 2019 at 12:39 PM

A little bit supplement, if you think the property name is kind of complex to type, you can open the .shadergraph file and search the paratermeter name shows in top left corner of Shader Graph window, in the same long line, you can find a "m_DefaultReferenceName" key value pair, which value is the property name you can use to set in C#.

alt text


微信图片-20190508203608.png (29.7 kB)
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
1

Answer by MagyarPeter · Sep 18, 2021 at 12:59 PM

Set the desired color's reference to "_Color"alt text (The REFERENCE, not the NAME)


nevssssstelen.png (1.2 kB)
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

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

Related Questions

How to add sprite or particles on shader 0 Answers

Shader help - 2d black and white polygons where black shows one background image and white shows another -1 Answers

Creating a line between different colors? 0 Answers

Is it worth keeping the built-in render pipeline? 0 Answers

Set color with matrix4x4 in shader graph makes color exploding with light in scene 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