Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Feature Request Expand sprite library assets to be able to color swap.

Discussion in '2D Experimental Preview' started by Vosheck, Jul 25, 2020.

  1. Vosheck

    Vosheck

    Joined:
    Feb 29, 2016
    Posts:
    12
    https://docs.unity3d.com/Packages/com.unity.2d.animation@2.2/manual/SLASwap.html
    details how to color swap between the colors of the 2 different palettes of the imported images.

    What would be very neat to have is the ability to import just a grayscale sprite, and be able to determine the color of a certain gray area directly in unity. It would be nice to be able to save the colors of a certain gray area in a kind of a preset, and maybe even save a colored sprite as a prefab variant.

    It seems very tedious redundant to create copies of differently colored sprites within imaging programs, with the inability to quickly modify a color of a certain part down the line.
     
  2. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    518
    Can you make a custom shader in shadergraph and the sprite lit master mode to achieve what you’re looking for?
     
  3. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,533
    Give Shader Graph a try - in particular the Color Replace node. You could even convert everything from RGB to HSV so you can color replace a particular hue. This would allow you to replace a range of values, for example dark magenta to light magenta, with for example dark blue to light blue or dark red to light red.

    Another approach to this problem would be to use sprite generation. Here's an example:
     
    Last edited: Aug 18, 2020