I just bought this component and I am using it with the full version of NGUI (2.2.1). I am unsure of how to apply this in my context, so would like a bit of help please.
I want to have a score float up above a Star object whenever the user collects them. The player is moving up the screen rapidly (think doodle jump) and trying to collect stars along the way. The stars are in the main scene rendered by the main camera. I have created the following UI hierarchy:
UI Root (2D)
-Camera
--Anchor - Top Left (score labels)
--Anchor - Top Right (high score labels)
--HudText - contains only HudText and UIFollowScripts
In the collision detection script for my player, I am trying to make the HudText appear above the star like this:
if(collision.gameObject.tag=="Star") {
// Get Collect Star script and trigger it
var coll : StarCollected = collision.gameObject.GetComponent(StarCollected);
// Setup Hudtext for collection
follow.target = collision.gameObject.transform;
hudText.Add("100", Color.white, 0.5f);
// And tell the star to collect itself
coll.CollectStar();
}
But nothing is appearing on screen. I have set the Font for the text in the HudText component.
Am I missing something? Is this the best way? Also a bit concerned about if the users collects 2 stars in a row too quickly, what would then happen.
Thanks