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

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » HELP » Help (General) » Would Appreciate Some Help

Would Appreciate Some Help

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Would Appreciate Some Help on Thu Aug 21, 2014 9:05 am

Uzzgrock


Member [Lv. 1]
Member [Lv. 1]
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.

View user profile

2 Re: Would Appreciate Some Help on Thu Aug 21, 2014 5:52 pm

OneManArmy


Member [Lv. 2]
Member [Lv. 2]
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!

View user profile

3 Re: Would Appreciate Some Help on Thu Aug 21, 2014 7:26 pm

Grimmdev


Member [Lv. 1]
Member [Lv. 1]
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!

View user profile

4 Re: Would Appreciate Some Help on Fri Aug 22, 2014 8:46 am

Uzzgrock


Member [Lv. 1]
Member [Lv. 1]
Thank you.

View user profile

5 Re: Would Appreciate Some Help on Sat Aug 30, 2014 10:28 pm

BryceCain25


SUPER MODERATOR
SUPER MODERATOR
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

View user profile

6 Re: Would Appreciate Some Help on Sat Aug 30, 2014 10:31 pm

BryceCain25


SUPER MODERATOR
SUPER MODERATOR
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

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum