Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Sprite masks in procedurally generated worlds

Discussion in '2D' started by Valynna, Jul 25, 2022.

  1. Valynna

    Valynna

    Joined:
    Apr 1, 2021
    Posts:
    39


    So I have my own hexagonal floor tile system, like so.

    The ground texture (the cracks on the ground) have one giant sprite mask affecting it, so that the ground texture only show up on top of the hex cells. There's also cell blending, etc... which all also needs to use this sprite mask.



    Unfortunately, the only way I could find out how to do this was to make floor meshes that I apply a material to with the mesh renderer and then I make an entire new camera that only sees these meshes. I think take a screen shot, save the data, modify the data (load it up, fix the alpha values, etc), and then apply the sprite mask.

    Obviously that's way too time consuming and it isn't very flexible for larger maps, etc.

    What other ways can I make sprite meshes out of combined shapes? If I put a single hexagonal sprite on the floor, then can I somehow "bake" a few hundred sprites into one spritemask, for instance?