“Ubah warna kesatuan objek” Kode Jawaban

Cara Mengubah Warna Suatu Objek dalam Unity C#

//You can either change material color of an object, or a color of component SpriteRenderer,
//which doesn't really matter unless you have lights added in yout project.

//so lets get a color (blue for this example)
public Color myColor = new Color(0, 0, 1, 1); //(r,g,b,a) 
//changing material color looks like this : 
gameObject.GetComponent<Renderer>().material.color = myColor;

//changing SpriteRenderer color looks like this :
gameObject.GetComponent<SpriteRenderer>().color = myColor;
Xixika

Ubah warna kesatuan objek

 private Renderer materialRender;

    void Start()
    {
		materialRender = GetComponent<Renderer>();
        materialRender.material.color = new Color(1f, 0f, 1f, 1f); //Color(r, g, b, a)
    }
Nimorum

Jawaban yang mirip dengan “Ubah warna kesatuan objek”

Pertanyaan yang mirip dengan “Ubah warna kesatuan objek”

Lebih banyak jawaban terkait untuk “Ubah warna kesatuan objek” di C#

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya