- Home /
Vector Graphics Package Change sprite color
Hello guys,
I imported a complete white SVG with the "Vector Graphics Package" But how can I change the fill color? Normally I do it with the "color" on the "Sprite Render" component but with svg's it's not working.
I want to spawn circles and randomly choose a color.
Have a great day, Steven
Answer by nzhul · Jun 19, 2020 at 05:41 AM
I am trying to do the same ... no luck so far :( If someone have information, please tell.
Answer by Kadjai · Jul 23, 2020 at 09:25 AM
Came here looking for the Same.
Hey guys, I remember that i found out how to do it, but forgot to answer here. Basically there are two steps. 1. $$anonymous$$ake sure your svg image is filled with white. This will allow the color to be changed properly. 2. You should be able to change the color like that:
var image = leaveGameBtn.gameObject.GetComponentInChildren<SVGImage>();
image.color = Color.red;
Answer by Hansaya · Jul 24, 2020 at 03:00 PM
Can I paint a specific part of the SVG image using code c#
Answer by ChrisVMC · Dec 21, 2020 at 10:10 AM
You can make the Sprite Renderers color property workby creating a new Material from the default sprite and enabling instanced rendering on it. As per https://forum.unity.com/threads/vector-graphics-preview-package.529845/page-2#post-3522208
Then it works.