Tasharen Entertainment Forum
Support => Other Packages => Topic started by: vip_prizrak_3 on January 28, 2014, 09:37:21 AM
-
Hi.
I have a some problem with HUDText.
When I call Add() the first time all works fine: text appears in the starting position, moves up and gradually receding into invisibility.
When I call Add() the second time I have bug or something like:
1) text appears in the position where he disappeared in previous times and text is fully visible;
2) then text disappears;
3) text appears in the starting position;
4) moves up;
5) gradually receding into invisibility;
and this is repeated every next time.
This is clearly seen when object with HUDText.cs has only one child object(pop-up message with name "0").
Maybe incorrect sequence of operations to change the start position of the text and its transparency in HUDText.cs?
Version of HUDText 1.9.
-
What version of NGUI are you using? I don't see any issues with the provided second example. Can you reproduce it there?
-
NGUI wersion 3.0.9(f2).
No, I can't reproduce it in second scene((
I create test-scene,added my prefab with HUDText, added button and when push the button call Add("test", Color.red, 0.1f) and all works. But in the game is not working properly.
In the game in Update() I print to log the position and color pop-up message, when object isActive:
Debug.LogWarning(transform.localPosition.y+ " : "+ GetComponent<UILabel>().color);
and I got:
0 : RGBA(0.000, 1.000, 0.000, 1.000).
If look to log all right.
But then i printed to log in OnGUI() I got:
39.99947 : RGBA(0.000, 1.000, 0.000, 1.000)
39.99947 : RGBA(0.000, 1.000, 0.000, 1.000)
0 : RGBA(0.000, 1.000, 0.000, 1.000)
0 : RGBA(0.000, 1.000, 0.000, 1.000)
0.006145842 : RGBA(0.000, 1.000, 0.000, 1.000)
Object becomes visible in a position where he disappeared last time.
With previous version HudText ang NGUI 2.7 everything worked, but now I do not know what can be done.
If you have time please see video: http://youtu.be/8pkOMbmNR3g (http://youtu.be/8pkOMbmNR3g)
-
HUDText is meant to be used from Update(), and never from OnGUI. If you use it from OnGUI, then a label will be enabled, but the positioning logic won't run until the next frame.
-
I don't used HUDText from OnGUI.
I only call Add() when intersect with object or message will come, but I don't do this from OnGUI(((
-
So where do you call it from then? It should be from Update().
-
During the test I printed to log a message about the position and color on OnGUI() and Uddate().
But in game was the intersection with the trigger and there I call the function Add().
-
So... Physics? Same thing applies. It must be done from Update(). You generally should never do any UI interaction from physics functions. Disabling panels there will cause an error for example. Start a coroutine from your physics callback. Inside that coroutine do your Add().
-
no, it did not help((
text first appears in the position where it was ended, and then become the starting.
When I call Add() by pressing a button all works fine, but when comes to me some a message from the server - it happens.
-
What message from the server? What's the actual call stack?
-
I fixed all.
Messages received from the server I added to the list. And then in Update() I added them from the list to HUDText.Add().
Thanks for helping.