FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Share

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

descriptionRe: 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!

descriptionRe: 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!

_________________
Let's do this... or that.. or that other that... or something along the lines of this... .-. nuuuuuu

descriptionRe: Would Appreciate Some Help

more_horiz
Thank you.

descriptionRe: 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

_________________
-BryceCain25

descriptionRe: 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

_________________
-BryceCain25
Permissions in this forum:
You cannot reply to topics in this forum