Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Selecting multiple non-sequential elements of a texture for Flipbook

Discussion in 'Visual Effect Graph' started by AssembledVS, Apr 1, 2020.

  1. AssembledVS

    AssembledVS

    Joined:
    Feb 23, 2014
    Posts:
    248
    Using Unity's built-in Particle System's "Texture Sheet Animation" module, I can select "Sprites" mode and input a bunch of sprites from the same texture or Sprite Atlas. I can easily randomize the selection and even add weight to certain sprites by adding the same ones multiple times. It looks something like this:



    Now, I figured out how to randomize a Flipbook animation in Visual Effect Graph (not play each image sequentially) by following this post from @JulienF_Unity , but I'm not sure how I can select multiple non-sequential indexes. For example, I know how to select texIndex 0-5, but not 0-4, 9-13, and 20 at the same time.

    Is there a relatively simple way of doing this? Perhaps some node or block that I'm missing? I just started experimenting with Visual Effect Graph yesterday so there's a lot that I don't know yet.
     
  2. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi @AssembledVS ,

    You can use a curve to remap any custom value you'd like. From your example, here is a curve that is using a time input (multiplying it by a small amount so it'll go slower, and using frac to keep it in 0-1 range (or you can also set the curve itself to loop)) and I am setting the Tex index value with it to get 0-4, 9-13, and 20.


    Here is the result:


    Hope this helps!
     

    Attached Files:

    pjbaron and florianhanke like this.