Hello, I'm new with unity and i'd like to color a sprite with a color (with transparency). Here is a sprite But if i use the color parameter in the sprite renderer, i obtain this : But this is not the effect i want (the blue become black, and if i change the alpha, it is the whole sprite that become transparent) I want to get this instead : How can i do this (here i use red color, but i want to be able to change this color while the game is running) ?
If just changing the sprite color doesn't suffice, then you'll probably have to write (or find) a custom shader.
You might want to check out this Sprite-Outline shader for 2D this guy made. http://nielson.io/2016/04/2d-sprite-outlines-in-unity/ You can get something like out of it.
Thx for your comments. I had a look at shaders and it seems to be a little too complicate for me for the moment I'm learning unity and i prefer to focus on "basics things" and master them before using more advanced options. I think i will change what i planed, and adapt my game for use the color parameter of the sprire renderer. When my game will be finished, i'll improve graphics with shaders.
That's a good plan. You can easily get sidetracked on something like this, as some small feature turns out to be as hard as the rest of your game! Better to just adapt and continue, especially at first.