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 giosto · Oct 01, 2018 at 06:09 AM · shadergraph

Make shader for UI

hey guys

just a little question

I'm making material using shadergraph and I want to attach it on mu UI element. how is it possible?

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

5 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by cnczcraft · Oct 01, 2018 at 06:26 AM

No make a sprite in a paint program shader graph is 3d only. Out of curiosity, why do you want to do this?

Comment
Add comment · Show 5 · 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 giosto · Oct 01, 2018 at 06:44 AM 0
Share

I'm going to make dynamic health bar shader :/

avatar image giosto · Oct 01, 2018 at 06:46 AM 0
Share

any other advice?

avatar image cnczcraft · Oct 01, 2018 at 06:49 AM 0
Share

$$anonymous$$ake a sprite for the different colors of bar and move the bar with your health. Then either mask the end of the bar that sticks out or hide it at the edge of the screen.

avatar image giosto · Oct 01, 2018 at 07:04 AM 0
Share

the goal, I want to achieve is something different. I've already made shader. all I have to do is attach it on UI element. or maybe can I make 'fake' UI image?

avatar image cnczcraft · Oct 01, 2018 at 07:35 AM 0
Share

You can't UI elements don't take materials I think

avatar image
0

Answer by ValakhP · Oct 03, 2018 at 10:47 AM

Hello giosto,



I don't use shader graph, but in general, there is no a lot of difference between shaders for UI and world objects.



If it's possible, take a look on built-in UI shaders and compare it with the shader that shader graph gives you.



Simple shaders should work both on UI elements and 3D objects. It it's not - find differences between your resulting shader and built-in one.



You can download build-in shaders from here: https://unity3d.com/ru/get-unity/download/archive

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 Dankey_Kang · Oct 03, 2018 at 01:24 PM

I havent used shadergraph so forgive my ignorance but I believe you can add a material to UI components, for example if you look at Image components you'll notice an object field named material. You set it there.

UI materials are handled a little differently then normal 3D materials and there are some special considerations.

An example of special considerations is how _MainTex is handled in shaders designed for the Text component, _MainTex is passed a texture by the Text component itself and it is an image of the relevant letter I think.

It will depend on the UI element you are using, sounds like this will be an Image component if it is a health bar.

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 metalouis · Oct 29, 2018 at 04:42 PM

You can make shaders for the UI, though mine only seem to work in editor and not play mode unless I set the canvas to use screen space-camera, otherwise its just black for me. FYI if you want to get the colour of the UI element add a vertex colour node.

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 leshemamit · May 24, 2019 at 07:16 AM

I've used shader graph for UI Image (also works for RawImage) and made a tutorial about it! hope you will find it useful:

https://www.youtube.com/watch?v=Nbvqi8cfnrc&list=PLhQGsXIRIGQ3Z99Z60tIGsK3kmpRRuvbj∈dex=2

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

152 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 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 Graph not showing when included in build? 0 Answers

Outline in shader graph 0 Answers

Intersection / Geometry blend shader graph problem 0 Answers

Shader Graph Positioned Vertex Normals 2 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