Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Simple animated texture - where to start? [SOLVED]

Discussion in 'General Graphics' started by Hi_ImTemmy, Oct 21, 2018.

  1. Hi_ImTemmy

    Hi_ImTemmy

    Joined:
    Jul 8, 2015
    Posts:
    174
    Hello folks,

    I want to learn how to animate a texture on a gameObject. Here's the situation:

    I've made a little model. Say hello to the door computer!



    The model was made and UV mapped in Blender, then exported as FBX:



    What I'd like to do is get to the point where the bottom set of coloured lights appear to change colour. How would I go about doing this?

    Should I be messing around changing UV cords somehow?
    Or can I swap out / change materials on a loop?

    Thanks!
     
    Last edited: Oct 21, 2018
  2. Torbach78

    Torbach78

    Joined:
    Aug 10, 2013
    Posts:
    296
    I would separate the buttons and make this task more modular : scroll a simple texture slowly

    • 9x quads
    • a new material using a 32x32 texture, each pixel a unique color
    • scale down each quad to a single point in UV space
    • distribute them into the 3x3 pattern so they use different UV space
    • set the texture repeats (0.3, 0.3) and turn filtering off
    • scroll the texture over time diagonally such as 3U : 1V
     
    Hi_ImTemmy likes this.
  3. Hi_ImTemmy

    Hi_ImTemmy

    Joined:
    Jul 8, 2015
    Posts:
    174
    Thanks for the suggestion! I can certainly see the approach which is to treat all the squares individually, however the process outlined was way over my head.

    In the end I setup a simple IEnumerator and changed the overall texture at runtime using renderer.material.mainTexture. This achieved the desired effect!