Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - steddyman

Pages: 1 [2]
16
Other Packages / Re: NGUI: HUD Text
« on: September 29, 2012, 07:31:49 AM »
Thanks.  Using that method now but still no text appears.

If I pause the game, and use the Widget tool to create a label under the Hud object it appears just fine.  However all the HUDText (Clone) prefabs that appear under that display nothing.

I've tried everything.  Pausing the game and moving the transforms of the HUdText or sub text object that gets greated, enabling and disabling components.  Nothing works.  It only works if I setup a quick test scene and don't spawn anything using prefabs.

As I said, even zooming right in on the editor and there is nothing visible. It's like the text is blank.

I notice that if I pause the game immediately after issueing hudText.Add the little label that gets created under the hudtext is disabled.  I've tried enabling this too and still nothing appears.  Completely lost here.

I've attached a screenshot of what it looks like running.  My other GUI elements work and as stated above manually creating a label also works:
 

17
Other Packages / Re: NGUI: HUD Text
« on: September 28, 2012, 03:48:23 PM »
Sorry about this.  Can you post a small sample of the code you have for instantiating the prefab.  I am using the following, however despite the HUDText appearing in the folder and being in the right layer, it doesn't appear.  Even zooming into it in the Editor show it position right but invisible.

  1.         // Create a hud text for the score
  2.         var hudObj : GameObject;
  3.         hudObj = Instantiate(hudTextPrefab, transform.position, Quaternion.identity);
  4.         hudObj.transform.parent = hud.transform;
  5.         //hudObj.transform.localScale = Vector3.one;
  6.         // Get the HudText  and UIFollow components
  7.         var hudText : HUDText = hudObj.GetComponent(HUDText);
  8.         var follow : UIFollowTarget = hudObj.GetComponent(UIFollowTarget);
  9.         // Set the target to the transfor of the star
  10.         follow.target=transform;
  11.         // Now add the score text
  12.         hudText.Add(score.ToString(), Color.white, 0.5f);
  13.  

18
Other Packages / Re: NGUI: HUD Text
« on: September 28, 2012, 03:11:32 PM »
Never mind, found it.  Needed to be on a UIAnchor.

19
Other Packages / Re: NGUI: HUD Text
« on: September 28, 2012, 02:39:13 PM »
Thanks, that will work.

However, why is this not working at all?  I get nothing on screen for it.  What am I missing?

20
Other Packages / Re: NGUI: HUD Text
« on: September 28, 2012, 09:31:44 AM »
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:
  1.         if(collision.gameObject.tag=="Star") {
  2.                 // Get Collect Star script and trigger it
  3.                 var coll : StarCollected = collision.gameObject.GetComponent(StarCollected);
  4.                 // Setup Hudtext for collection
  5.                 follow.target = collision.gameObject.transform;
  6.                 hudText.Add("100", Color.white, 0.5f);
  7.                 // And tell the star to collect itself
  8.                 coll.CollectStar();
  9.         }

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

21
NGUI 3 Support / Re: Error when update 2.21
« on: September 28, 2012, 02:53:22 AM »
Thanks, but I don't think that was the problem.  I have three cameras, as follows:

1. Background cam - Depth 0 - Shows stars and Skysphere
2. Main cam - Depth 1 - Shows all 3d objects
3. GUI cam - Depth 2 - Shows GUI

The Background cam is set to Solid colour and the other two are set to Depth only.

Found when compiling to device was fine, problem only existed in editor.  However we had a power failure last night, and when I booted my Mac back and ran Unity, the problem was then gone in Editor too!!

22
NGUI 3 Support / Re: Error when update 2.21
« on: September 27, 2012, 03:58:48 PM »
I too got this error, and I am running Unity 4.0 b10.

I'm not sure if this is related, but my main issue is since upgrading my GUI seems burned into the panel.  When I click Play I get the same labels repeated over the top.  I tried deleting and recreating the UI, but even with no controls present the Panel is still displaying the text from the two Labels I had previously.

Pages: 1 [2]