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
0
Question by Raresh · Apr 19, 2015 at 04:45 PM · c#material

Animated material?

How can i make a material that is animated? Such as making animated lava or some other type of material that is constantly changing? Thanks for any help :)

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

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

Answer by Cherno · Apr 19, 2015 at 06:06 PM

Here are a few scripts that use a sprite sheet.

Link

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 Raresh · Apr 19, 2015 at 06:09 PM 0
Share

Thanks for your answer but i was hoping there would be a method without using sprite sheets as i don't know how to make them really... maybe having 1 texture and "moving" it or something?

avatar image Cherno · Apr 19, 2015 at 06:45 PM 0
Share

What do you mean, you don't know how to make them? It's just a big image with several smaller images inside :) Even $$anonymous$$S Paint can do this! :)

Other than that, here's a simle scrolling uv script like Owen was talking about.

 var uvOffset : Vector2 = Vector2.zero;
 var materialIndex : int = 0;
 var uvAnimationRate : Vector2 = new Vector2( 0.0f, 1.0f );
 var textureName : String = "_$$anonymous$$ainTex";
 
 function Update () 
 {
     uvOffset += ( uvAnimationRate * Time.deltaTime );
     if( renderer.enabled )
     {
         renderer.materials[ materialIndex ].SetTextureOffset( textureName, uvOffset );
     }
 }
avatar image
2

Answer by Owen-Reynolds · Apr 19, 2015 at 06:29 PM

You can change the Material's Offsets, in code, to scroll the material. Can also change the scaling, usually back and forth. A tiny change goes a long way, like between 0.9 and 1.1.

I think the built-in blend shader uses the same offsets for each texture. Otherwise you could move them at different speeds.

For a good animated texture, use a shader that keys off time (or other things you might set.) If you can find one, learning to write them is a huge pain (use Unity surface or frag/vert shaders. Not the shaderLab ones, since they can be configured. but not really programmed.)

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

21 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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Changing material on an object multiple times 0 Answers

Gl.Lines appearing over objects 0 Answers

How to create a complex material in an Editor-Script? C# 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