RedditPP Mascot

RedditPP

r/unity • … • u/Lord_Nathaniel

I need help with a color swapping shader

Hi all ! I'm pretty new in gamedev, and I've try to create some shaders in my Unity project, but I stumble into a problem. I hope this is the right place to ask this kind of thing.

I've create simple 2D png (64px x 64) with three colors, and I'm trying to implement a shader which can convert each color with the current player's one. But when I use the Play button, the final render is kinda funny.

So did I do something wrong in the shader ? Or maybe is it the implementation code ?

Shader's code (ColorSwap) can be found here : [https://github.com/Lord-Nathaniel/MyBlokusPrototype/blob/main/Assets/Shader/ColorSwap.shadergraph](https://github.com/Lord-Nathaniel/MyBlokusPrototype/blob/main/Assets/Shader/ColorSwap.shadergraph)

And implementation in the UIManager, here : [https://github.com/Lord-Nathaniel/MyBlokusPrototype/blob/main/Assets/Scripts/UIManager.cs](https://github.com/Lord-Nathaniel/MyBlokusPrototype/blob/main/Assets/Scripts/UIManager.cs)

(please, remember this is a WIP from a beginner)

Thank you all !

— 0