Integrating Unity 4.6 Text

I have an object goodGuys in the Hierachy and an object badGuys in the Prefabs folder. Both of these have associated javascript files. I created a canvas and then text objects to show “Good Guys Killed” and “Bad Guys Killed” with Unity 4.6. What do I need to do in the inspector and the scripts to count the kills and update the text objects (e.g., show “Good Guys Killed: 1” and “Bad Guys Killed: 10”)? Are there any good examples or tutorials that explain this in detail?

Thats fairly game specific, but take a look at the Nightmares tutorial. It has a score counter which you can use as an example

The video tutorial helped but I experimented until I was able to get things to work. It would be helpful to have a written tutorial that shows writing a script for a Unity 4.6 GUI component, attaching it to the component, and then calling this script from a script in another component. Are there any examples using UnityScript/JavaScript scripts attached to Unity 4.6 components other than C# scripts?

no in the attached project we’ve only done C# scripts as thats what we are switching to as the standard.

What do you mean by “as the standard?” Should I be using C# instead of UnityScript/JavaScript from now on?

you can use what ever language you like, if your more comfortable with UnityScript/JavaScript by all means use them. But our doc examples now default to C# (use to be javascript but you can still change them to whatever you like), and i believe all of our tutorial videos will be shown in C# now.

hello,
i’m looking for info about Text class in new unity 4.6 user interface.

Maybe i’m wrong with the structure of my scripts, i’m a noob.

I’ve created an uiText with no text, and include it in my ControlScript like a public Text so i can attach it directly.
Then whenever i need to show the text I call a function that use sendmessage method that sends the “textToShow” to my ControlScript. There is an IEnumerator coroutine that gets the textToShow, set it in the uiText and set it as enabled, as a coroutine it set the uiText enabled certain amount of time and then set it as dissabled.

It works in editor perfectly, but when i build it on my phone it throws me a annoying lag. why? im looking for the reason

Thanks.

I’m using free version of Unity 4.6 0b17

I’m not 100% sure why you’d see lag, it could be something as small as sendmessage taking longer on device then in editor or it could be a bug that got fixed in a later beta as b17 is fairly old.

i’ve used sendmessage many times in this game and works fine on my phone (motoG 2014), so i think it could be a bug.
do you think i need to change my scripts schemes, using differents methods or is better to update unity? i only need to show messages like: “bonus time” or “you are dead” or “you are awesome” or “no ammo”. short and full screen messages to the player.

the lag stops all the game for a fraction of a second but you can see how every moving objects do a stop and go.

thanks again.

…downloading the update;)

updating do not fix the problem.