|
Post by thehobliks on Jul 20, 2014 8:06:10 GMT
i'm trying to change the font/color/position of the Score and for some reason i'm not having any luck with this at all. tried several different script examples but none of them have worked. i'm new to this so any help would be appreciated. thank you.
|
|
DarkTonic Dev
Administrator
Posts: 4,386
Posts: 4,386
Member is Online
|
Post by DarkTonic Dev on Jul 20, 2014 18:56:58 GMT
Are you using Unity GUI? If so, I don't know the answer as we never use Unity GUI for our games because it's very limited and extremely slow performance. Try asking on the Unity support forum (let me know if you don't know where that is).
If you're using NGUI, you should have a color property of the UILabel where you can change the color. Any other plugin and the answer is: I've never used it so I don't know.
|
|
|
Post by thehobliks on Jul 20, 2014 19:02:02 GMT
Are you using Unity GUI? If so, I don't know the answer as we never use Unity GUI for our games because it's very limited and extremely slow performance. Try asking on the Unity support forum (let me know if you don't know where that is). If you're using NGUI, you should have a color property of the UILabel where you can change the color. Any other plugin and the answer is: I've never used it so I don't know. i'm actually trying to code it in either js or c#. all i want to do is have a gui text object display one of the world variables created.
|
|
DarkTonic Dev
Administrator
Posts: 4,386
Posts: 4,386
Member is Online
|
Post by DarkTonic Dev on Jul 20, 2014 19:37:05 GMT
|
|
|
Post by thehobliks on Jul 20, 2014 21:25:44 GMT
i'm not sure what you mean. what i'm trying to do is on i believe page 20 of the readme file.
#pragma strict var variable = WorldVariableTracker.GetWorldVariable("Score"); function Start () { guiText.text = variable.CurrentIntValue; } function Update () { }
i'm just simply trying to retrieve a world variable and have it printed on the screen. from what i gathered from the readme file this is pretty much what it says to do but i can't get it to work.
|
|
DarkTonic Dev
Administrator
Posts: 4,386
Posts: 4,386
Member is Online
|
Post by DarkTonic Dev on Jul 20, 2014 21:30:43 GMT
You can look at example Scene 2 (triggered spawners), as Score, Lives, etc are already set up correctly there the way you want. It's included in the plugin. You don't need to write code, you just use a World Variable Listener.
However I have no idea how to change the color.
|
|
|
Post by thehobliks on Jul 20, 2014 21:54:44 GMT
i already have that working and that is not what i'm trying to do. thanks anyway.
|
|
DarkTonic Dev
Administrator
Posts: 4,386
Posts: 4,386
Member is Online
|
Post by DarkTonic Dev on Jul 20, 2014 22:11:39 GMT
Sorry I couldn't help you on this. I would suggest though that you do pick up a standalone GUI package such as NGUI or DF-GUI. They are much easier to figure out and way more powerful. Of course Unity 4.6 will have a new GUI system, and I hope it's as good as those, but I doubt it will be initially.
|
|
|
Post by thehobliks on Jul 21, 2014 3:56:48 GMT
after digging through the worldvariablelistener script i found a section commented "PLEASE replace this OnGUI with an update to NGUI instead or whatever you use. This is just used for illustrative purposes." i guess this is what i'm looking for. am i suppose to replace the actual code? and if so what do i replace it with exactly?
|
|
DarkTonic Dev
Administrator
Posts: 4,386
Posts: 4,386
Member is Online
|
Post by DarkTonic Dev on Jul 21, 2014 4:22:06 GMT
You didn't say you were using NGUI - are you? If you're using Unity GUI I don't understand why you want to replace the code at all (it works with Unity GUI already). If it's just to change the color of text, well I don't know how to do that with Unity GUI. But someone on the normal Unity forum could tell you. I think it has something to do with a "skin" but I never got that to work and gave up and bought NGUI.
|
|
|
Post by thehobliks on Jul 21, 2014 4:36:56 GMT
i have ngui but haven't really used it so i don't know what i'm doing in it. what i was trying to do earlier was basically retrieve the static variable from the worldvariabletracker like it said you could in the readme file so i could put it in a gui text and then have more control over it (color, font, size, etc).
|
|
DarkTonic Dev
Administrator
Posts: 4,386
Posts: 4,386
Member is Online
|
Post by DarkTonic Dev on Jul 21, 2014 4:45:55 GMT
Ok, then you can edit the WorldVariableListener file as you like, or make your own script based on it. Although I can't help you with how to alter the color, font, size etc. I know very very little about Unity GUI because it's not considered a "serious" GUI and we needed something serious right off the bat. Hopefully that changes when Unity 4.6 comes out.
|
|
|
Post by thehobliks on Jul 21, 2014 4:49:33 GMT
i'm not trying to edit that file. i saw the comment and was asking for clarification. this has got way more complicated than what it actually is.
|
|
DarkTonic Dev
Administrator
Posts: 4,386
Posts: 4,386
Member is Online
|
Post by DarkTonic Dev on Jul 21, 2014 5:08:25 GMT
That comment part about NGUI is outdated, since we have an NGUI version of the WorldVariableListener in the NGUI package. I've updated it now. The new comment is: "This is just used for illustrative purposes. You might replace this with code to update a non-Unity GUI text element. If you use NGUI, please install the optional package "NGUI_CoreGameKit" to get an NGUI version of this script, replacing this one."
However, you could change that OnGUI method to do whatever you like to display a different font / size / etc if you know how to do that with Unity GUI, like maybe adding an actual GUIText component with a skin and using that...
|
|