0
\$\begingroup\$

I have the following situation, where in I need to animate textures on 3D animating plane in runtime.

  1. There are 5 panels in the unity scene and two buttons, each button, when clicked triggers one state of an animation.

  2. Each time the animation triggers, the textures on the panels has to change dynamically, the textures which will be on panels when animation triggers are loaded from backend,

-> The problem here is the textures are not sync with panel animations.

-> I have written a simple code that swaps the textures.

-> The code works fine but I wanted make sure that the textures are swapped smoothly with animation.

Is there any way where in I can swap the panel textures in sync with animation? This Image GIF shows Panal animation and snapping of Textures from one panal to other

Any sort of guidance, lead would be helpful.

public void LoadNextReelThumbnails()
{
    var last = videoPanelTextures.Dequeue();
    Debug.Log(videoPanelTextures.Count + " ##########");
    var a = panalRightObjects[0].GetComponent<Renderer>().material.mainTexture;
    var b = panalRightObjects[1].GetComponent<Renderer>().material.mainTexture;
    var c = panalRightObjects[2].GetComponent<Renderer>().material.mainTexture;

    panalRightObjects[2].GetComponent<Renderer>().material.mainTexture = last;
    panalRightObjects[1].GetComponent<Renderer>().material.mainTexture = c;
    panalRightObjects[0].GetComponent<Renderer>().material.mainTexture = b;

    var x = panalLeftObjects[0].GetComponent<Renderer>().material.mainTexture;
    panalLeftObjects[0].GetComponent<Renderer>().material.mainTexture = a;
    panalLeftObjects[1].GetComponent<Renderer>().material.mainTexture = x;
}
\$\endgroup\$
2
  • \$\begingroup\$ It's very difficult to understand what you're trying to do from the video. What kind of animation do you want the textures to be in sync with? \$\endgroup\$ Commented Apr 20, 2023 at 18:57
  • \$\begingroup\$ @Kevin actually the panels which you you see are animated. but if you look at the images along with animation playing, it feels like they are are just snapping from one panel to other, and not animating. I wanted to make sure that the textures snap smoothly from one panel to other as the animation plays. \$\endgroup\$ Commented Apr 20, 2023 at 19:58

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.