Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Share
Go down
avatar
Member [Lv. 1]
Member [Lv. 1]
Posts : 2
Points : 1437
Rep : 0
Join date : 2014-08-17
View user profile

Would Appreciate Some Help

on Thu Aug 21, 2014 7:05 pm
Greetings,

I found out that Orange is not a valid colour in C#.
Could someone please help me understand how I can add Orange?
It will be used for a health bar I am creating.

Thank you.
Member [Lv. 2]
Member [Lv. 2]
Posts : 5
Points : 1435
Rep : 0
Join date : 2014-08-20
View user profile

Re: Would Appreciate Some Help

on Fri Aug 22, 2014 3:52 am
If there's not a default version of a colour you have to make one for yourself!

Code:
public Color orangeColor = new Color(0,0,0); //Replace 0 with the color code - fo   dis I suggest to use Color picker from shaders and then copy paste the values

Read the Unity Scripting Reference before asking stupid questions!
avatar
Member [Lv. 1]
Member [Lv. 1]
Posts : 3
Points : 1433
Rep : 0
Join date : 2014-08-22
Age : 29
Location : Spring Hill
View user profile

Re: Would Appreciate Some Help

on Fri Aug 22, 2014 5:26 am
Following on what OneManArmy said.
C#
Code:

public Color orange = new Color(255,102,0);
JS
Code:

var orange : Color = Color(255,102,0);

Add that to the top of your script that you need the orange color for, simple as that!
avatar
Member [Lv. 1]
Member [Lv. 1]
Posts : 2
Points : 1437
Rep : 0
Join date : 2014-08-17
View user profile

Re: Would Appreciate Some Help

on Fri Aug 22, 2014 6:46 pm
Thank you.
avatar
SUPER MODERATOR
SUPER MODERATOR
Posts : 279
Points : 2139
Rep : 58
Join date : 2013-12-17
Age : 17
Location : Boise Idaho United States
View user profile

Re: Would Appreciate Some Help

on Sun Aug 31, 2014 8:28 am
Uzzgrock wrote:Thank you.
to clear things up a bit, the numbers you see in the code actually represent a color, so the numbers presented will give you a color sort of like the color picker option you have in Unity, it uses different color combos to find the perfect shade and color you are looking for.
Hope this will help you for future reference
avatar
SUPER MODERATOR
SUPER MODERATOR
Posts : 279
Points : 2139
Rep : 58
Join date : 2013-12-17
Age : 17
Location : Boise Idaho United States
View user profile

Re: Would Appreciate Some Help

on Sun Aug 31, 2014 8:31 am
Grimmdev wrote:Following on what OneManArmy said.
C#
Code:

public Color orange = new Color(255,102,0);
JS
Code:

var orange : Color = Color(255,102,0);

Add that to the top of your script that you need the orange color for, simple as that!
well..you don't really "use" the variable until you start working with text (or some other sort of color based objects),
you first have to make some text through the gui, then use the color orange to make it orange Smile
I hope this will clear this up for the developer.
Not to call you out, it's just that she/he may not know how to actually use it inside of the text object

Smile
Back to top
Permissions in this forum:
You cannot reply to topics in this forum