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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Discussion Palette Swapping Performance

Discussion in '2D' started by loopholist3, Jul 11, 2022.

  1. loopholist3

    loopholist3

    Joined:
    Apr 14, 2022
    Posts:
    8
    I need to create a small collection of palette swapped characters that are animated using a sprite sheet. I can find lots of suggestions on how to do this, but I am struggling to find anything that discusses what is the correct way to do it. I mainly care about run time performance, and there is no need for the characters to change colors at runtime. I am also working with a small enough set of palette swaps that just having a different sprite sheet for each is a valid option.

    What would make the most sense to me is to set up a palette swap with a shader and then have unity pre-process all of the options I am using at compile time, but I don't think that is an option that actually exists.

    So I am really just looking for other people's opinions on what the best method of doing a palette swap is.
     
  2. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    832
    There is no "correct way" because it's not a feature built-in to Unity. :)

    Choose a shader or write a shader that has the features you deem most applicable to your workflow / desired result.

    (the usual approach is to replace specific color values or tint using a shader)