How to Change the Shader Color?
hey! I am using a standard shader. But am facing some problem.
this is my code::
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class BackGroundtrial : MonoBehaviour {
private Color anotherColor = new Color (253, 188, 134);
// Use this for initialization
void Start () {
SpriteRenderer s = GetComponent<SpriteRenderer> ();
s.material.SetColor ("_Color", anotherColor);
}
// Update is called once per frame
void Update () {
}
}
but what happens is that the color doesn't get displayed. When I tried to instead of putting an rgb value had used color in the following form :- color.red then the color got changed. So how can I use rgb values in order to change the colours.
Read this excellent e-book. You will probably only need the first chapter for this.
https://en.wikibooks.org/wiki/Cg_Program$$anonymous$$g/Unity
Your answer
Follow this Question
Related Questions
Need help to make a color replace shader 0 Answers
How to make shader like among us,How to create color shader like Among Us 1 Answer
Making clamped texture render parts outside of the uvs transparent 1 Answer
Creating a 3D portal effect using stencil buffer with a deferred shading setup? 1 Answer
LWRP Shader Graph material fades away with distance. 0 Answers