UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionWould Appreciate Some Help EmptyWould Appreciate Some Help

more_horiz
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.

descriptionWould Appreciate Some Help EmptyRe: Would Appreciate Some Help

more_horiz
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!

descriptionWould Appreciate Some Help EmptyRe: Would Appreciate Some Help

more_horiz
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!

descriptionWould Appreciate Some Help EmptyRe: Would Appreciate Some Help

more_horiz
Thank you.

descriptionWould Appreciate Some Help EmptyRe: Would Appreciate Some Help

more_horiz
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

descriptionWould Appreciate Some Help EmptyRe: Would Appreciate Some Help

more_horiz
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

descriptionWould Appreciate Some Help EmptyRe: Would Appreciate Some Help

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply