x


Changing a materials color in C#

I've been watching bergzerg arcade's hack & slash tutorial, and at the end of the 9th video he puts in a script that changes the default materials color. I'm using a custom model, with a custom texture/material. There are no errors in the script, and I have searched around on Unity Answers and google but I can't find anything that works. Thanks in advance!

more ▼

asked Apr 07 '11 at 03:24 AM

Blackop gravatar image

Blackop
19 3 3 7

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Try this:

C#: mObjectName.gameObject.renderer.material.color = new Color(R, G, B, A);

JS: mObjectName.renderer.material.SetColor("_TintColor", Color(R, G, B, A));

more ▼

answered Apr 07 '11 at 03:55 AM

Ren gravatar image

Ren
28 1 1 3

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5086
x817
x507
x391
x379

asked: Apr 07 '11 at 03:24 AM

Seen: 4325 times

Last Updated: Apr 07 '11 at 03:24 AM