Drawing multiple materials from a defined array on a single object
I am creating an animated advertisement banner similar to this:
http://postimg.org/image/yso1kkiv5/
I have an array of 5 materials, which I am currently switching between randomly. They are being drawn on a plane.
renderer.sharedMaterial = materials[index];
I'd like to now add in the scrolling effect to complete it.
This will require two materials to be drawn simultaneously with their offset being changed to mimic scrolling. How can I achieve this?
Perhaps If you work the TILING into it: you can create a SINGLE texture that is say... 5 banner-textures high. Then scale the y axis of the texture by 1/5 (set $$anonymous$$aterial's Tiling-y to 0.2). Now when you scroll the y offset, it should show different parts of the texture on the surface of the object. Note: I have not tested this, just thinking out loud.
@Glurth: Sorry, didn't see your comment until now. The problem is that I need the material to change randomly between textures. So a single sprite sheet is a no go.
perhaps you can generate a 2 part texture on the fly? Leave one part, the visible part the same, and change only the hidden half on the texture. When you swap out to the new texture, you would see no change, because the visible part of the texture remains the same. Once in place, you can scroll to show the previously hidden half. Then start over again, but overwrite the OTHER half.
Your answer
Follow this Question
Related Questions
HDRP Material and Lighting problems 0 Answers
Material.SetFloat not working 0 Answers
Changing Second Material 1 Answer
Unity 5.4.0f2 rendering 3ds max bones for some reason 0 Answers
Unity3d rendermode change at runtime not correctly changed 0 Answers