CHANGE COLOUR OF A SPRITE WITH BUTTON PRESS IN UNDER 1 MINUTE
Ойындар
#shorts
Enjoy the video, if you have any questions ask in the comments down below!
Request a tutorial here:
forms.gle/JLBkpHt1ZFLpn7TE9
Patreon with fully explained c# scripts:
/ blakeygames
Main Channel: / bblakeyyy
DISCORD SERVER LINK: / discord
unity,unity sprite,unity change color of sprite,sprite,unity tutorial,unity how to change sprite color,unity change color of image,unity change color of object,unity 2d,unity sprite color,unity change color,unity color sprite,unity change renderer color,sprite color,sprites,change a sprite's colour in unity,change colour of gameobject unity,change color of button in unity,change sprite unity,unity sprite shape,sprite colour changer
Пікірлер: 7
Very quick and usefull thanks!!
Hey I'm making a game that involves clicking Colored buttons and I was wondering how I could do it so when the button is clicked the sprite became that color.
@shouryasuthar
13 күн бұрын
public SpriteRenderer spriteren; public void SetColorButton(string yourcolor) { spriteren.color = yourcolor; } Just paste this in a monobehaviour script and after saving the script just go back into the editor and create a button then in the button component just click on the plus icon just under the on click text. Then, put the script on any gameibject and drag and drop it into the onclick function then select the script name in the dropdown next to it and then select the SetColorButton function under it. Now, you can type any color's name and the sprite will become that color on the click of a button.
Can you make a material one
@morebblakeyyy
Жыл бұрын
Sure
@SoulReaper7x
3 ай бұрын
Still waiting for that vid
@shouryasuthar
3 ай бұрын
@@SoulReaper7x here is a basic script that I found - using UnityEngine; public class MaterialChanger : Monobehaviour { public Renderer renderer; //This is the reference of the object's material you want to change. public void ChangeColor(Color color) { renderer.material.SetColor("_Color", color); } }