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 /
This question was closed Jul 31, 2019 at 08:46 PM by JaredHD for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by JaredHD · Mar 23, 2018 at 06:25 PM · shaderwaterperlin noise

Setting unitys new shader graphs properties via C#

Hi,

My problem and what I tried

I'm currently trying to set a property in Unitys new shader graph via my c# script. I tried the below, but it didn't work.
             material.SetVector("Offset", new Vector2(xCoord, zCoord));



What I am doing

I'm trying to make a water effect. I'm currently using perlin, and than editing an offset to make waves. I than made a water shader (in unitys new shader graph tool), and would like to try and match it against the offset so that it looks more realistic. Any suggestions? It would be greatly appreciated.



~Jared

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

2 Replies

  • Sort: 
avatar image
10
Best Answer

Answer by CHNGames · May 04, 2018 at 08:16 PM

Hello, You can access shader graph properties via c# script. Your code is true but the your property name is not offset, Unity's Shader graph names properties randomly. You need to use these names that are in red circle in image. alt text


xdd.png (38.2 kB)
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 JaredHD · May 04, 2018 at 08:24 PM 0
Share

Hi exploit4,

Thanks for the reply. I have moved on since than but I'll test out what you said the next time I mess with shaders again.

Thanks again.

~Jared

avatar image peterfiveeight · Jul 31, 2019 at 07:42 PM 2
Share

Thank you for this answer, really helped me out. It may be worth noting that you can also add your own reference for the value ins$$anonymous$$d of getting the randomly generated characters at the end of the name.

This can be defined in the shader graph window inside the respective property inside the dashboard.

Thanks again for the answer.

avatar image
0

Answer by Flindt · Nov 21, 2018 at 02:00 PM

Hi there

Is it true that it is not possible to set a property from within shader graph? = is it only possible to set from script?

Let say i need to store a temporary value - to offset something - then is it not possible inside shader graph?

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 CHNGames · Nov 22, 2018 at 06:48 AM 0
Share

Probably, they fixed the blackboard of Shader Graph. I haven't tested yet, but I think, you can set property values by using blackboard ins$$anonymous$$d of using script.

Follow this Question

Answers Answers and Comments

129 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

Related Questions

Can this explosion effect be created in Unity 3.5? 1 Answer

How to detect collision with shaders? 0 Answers

Changing Queue in shader has no effect 1 Answer

Unity Water4 simple shader not working from above 0 Answers

Different wave speeds 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