Adam's Lair Forum

game development and casual madness
It is currently 2019/12/14, 10:39

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Changing Text ColorTint
PostPosted: 2016/09/08, 06:33 
Novice Member
Novice Member
User avatar

Joined: 2016/04/03, 07:48
Posts: 17
Role: Hobbyist
Hello!

I can't find an example of how to set the color for text using code. Google search of this forum didn't return anything and the documentation that comes up when you hit F1 gives no examples how to use color tint for text. None of the options of completion intellisense gives does anything but throw errors. I feel like somewhere along the way I missed a set of a dozen hyperlinks to the answers to the obvious stuff that everyone else got. Or a pdf or something of instructions.

Sorry if this is another dumb one.

-ST


Top
 Profile  
 
PostPosted: 2016/09/08, 07:39 
Veteran Member
Veteran Member
User avatar

Joined: 2015/10/04, 15:48
Posts: 163
Location: Germany
Role: Hobbyist
Hey StupidThunder,

I think you are using the canvas-class, didn't you?

I'm just using my mobile phone so I don't know if this is correct:

Code:
myCanvas.State.ColorTint = Rgba.Red;


Best regards
Cross

_________________
Twitter | GitHub | Join Duality on Discord | itch.io


Top
 Profile  
 
PostPosted: 2016/09/08, 19:52 
Veteran Member
Veteran Member
User avatar

Joined: 2016/01/10, 10:56
Posts: 151
Location: Budapest
Role: Hobbyist
Hello,
Unfortunately, there's no 'cheat sheet' pdf at the moment. But there are some principles that can help you on the way. It's not quite clear, if you want to render text via Canvas, in that case have a look at Cross' post.
If you intend to use the TextRenderer Component, here's one important principle: you can obtain and in most cases modify a property of a component via code. Do this by creating a Custom Component, put on the same GameObject you want to modify, then call

Code:
// generally:
GameObj.GetComponent<ComponentType>().PropertyName = NewValue;
// in your case it is (notice the using statement):
using Duality.Renderers;
...
GameObj.GetComponenet<TextRenderer>().ColorTint = ColorRgba.White;


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group