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 - Cwal

Pages: [1] 2
1
NGUI 3 Support / UILabels breaking
« on: August 31, 2015, 06:09:43 PM »
I have a project that I upgraded to NGUI 3.9.2, and every time I change the font size on a label that is set to shrink content, I get a series of error messages that "Destroying GameObjects immediately is not permitted during physics trigger/contact, animation event callbacks or OnValidate. You must use Destroy instead." and the text gets stuck on the screen.  It seems to happen most consistently when the font size becomes greater than the height of the box.

I also get "NullReferenceException: Object reference not set to an instance of an object
UIDrawCall.CreateMaterial () (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:260)
UIDrawCall.RebuildMaterial () (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:348)
UIDrawCall.UpdateMaterials () (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:368)
UIDrawCall.OnWillRenderObject () (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:568)
UnityEditor.DockArea:OnGUI()"

when playing the scene after one of these errors occurs.
This is preventing me from rebuilding my UI, any help would be appreciated.

2
NGUI 3 Support / Misalignment Between Cameras
« on: June 05, 2014, 06:52:57 PM »
I am using Vuforia with NGUI providing 3d UI elements.  The UI camera is a child of the AR camera, set to only see things on the correct layer.

The UI camera is drawn on top of the AR camera.

The UI is a child of the Image Target, with the relevant pieces set to the correct layer to be visible.

My issue is that the UI camera isn't properly displaying it's elements.  They are there and interactable, but they aren't positioned properly with the view of the AR camera, they move as if the cameras aren't quite in the same position.  If I add the UICamera script to the AR Camera object, I can interact, but it breaks all the default Unity interactions.

3
NGUI 3 Support / Re: Forcing Scroll View to update
« on: April 28, 2014, 12:33:02 PM »
Is there an alternative to SpringPanel to do the centering?  It appears to be the tweening that SpringPanel.Begin causes that is breaking it.  If I yield for a second it will snap to the right place, otherwise it snaps for one frame and slides back to its original position.

Making SpringPanel instantaneous I still have problems with the bottom of the scroll view, even with several cycles of WaitForEndOfFrame followed by refreshing the panel.  Updating the widgets doesn't seem to have an effect either.  It definitely seems that the clipping for the scroll view isn't updating, no matter how long I wait.

4
NGUI 3 Support / Re: Forcing Scroll View to update
« on: April 24, 2014, 02:38:44 PM »
  1. public void Toggle()
  2.     {
  3.        
  4.         bool hasHappened = false;
  5.         bool thisTime = opened;
  6.         if (content != null)
  7.         {
  8.             Vector3 thisAdjustment = adjustmentSize;
  9.         foreach (TabSlider tab in tabs)
  10.         {
  11.             //Debug.Log(tab.name);
  12.             if (hasHappened)
  13.             {
  14.                 tab.transform.localPosition = tab.transform.localPosition + thisAdjustment;
  15.             }
  16.             if (tab.opened)
  17.             {
  18.                 hasHappened = true;
  19.                 thisAdjustment = tab.adjustmentSize;
  20.             }
  21.             tab.opened = false;
  22.             if (tab.content != null)
  23.             {
  24.                 tab.content.gameObject.SetActive(false);
  25.             }
  26.         }
  27.         opened = !thisTime;
  28.         Debug.Log(opened);
  29.         if (content != null)
  30.         {
  31.             content.gameObject.SetActive(opened);
  32.         }
  33.         foreach (TabSlider tab in tabs)
  34.         {
  35.             if (opened && tab.tabNumber > tabNumber)
  36.             {
  37.                 Debug.Log("Moved");
  38.                 tab.transform.localPosition = tab.transform.localPosition - adjustmentSize;
  39.             }
  40.             else
  41.             {
  42.                 Debug.Log("Not Moved");
  43.             }
  44.            
  45.         }
  46.     }
  47.         view.UpdatePosition();
  48.         view.RestrictWithinBounds(true);
  49.         StartCoroutine(Late());
  50.        
  51.     }
  52.     IEnumerator Late()
  53.     {
  54.         yield return new WaitForEndOfFrame();
  55.         if (view)
  56.         {
  57.             Debug.Log("Restricting");
  58.             view.RestrictWithinBounds(true);
  59.            
  60.         }
  61.     }
Here is the code I am currently using to resize and move the elements of the scroll view.  I am using a modified version of your Center script to center on a child of the clicked item, then after that movement is done, I call this to properly open and close the menus.  Then I call RestrictWithinBounds, but the menus still end up scrolled part way out of bounds when at the edges.  If the menu doesn't have a child, it is properly restricted, but when a child is added, it breaks. It also fails if Toggle is called on its own OnClick, which is how I initially set it up.

If the RestrictWithinBounds call is put into a coroutine and called a second later to ensure that the tweening has finished, it jumps to the position it should be in and then slides back to the center.

What does the instant bool change?  It isn't in the documentation.

5
NGUI 3 Support / Re: Forcing Scroll View to update
« on: April 22, 2014, 01:38:31 PM »
ResetPosition completely resets the view.  I need to stay scrolled to a specific object but remove the empty space generated by centering the object. When an object near the end of the content is centered, the view scrolls past the end and doesn't slide back so that it is properly constrained.

6
NGUI 3 Support / Forcing Scroll View to update
« on: April 21, 2014, 04:49:55 PM »
I have a scroll view that opens and closes panels on click, which means that the size of the scroll view changes at runtime.  I am having trouble getting the scroll view to update it's position so that when things are opened and closed, things stay properly bounded.  When the last item is closed, everything remains in the furthest scrolled position, so half of the view is empty.  I can't seem to find a way to force an update that will get it to move properly.  I have tried UpdatePosition, but it doesn't seem to work.

7
NGUI 3 Support / Scaling in Drag & Drop example
« on: April 11, 2014, 06:38:26 PM »
I made a simple modification to the drag and drop example, to handle dragging an object onto a differently scaled one.  I manually instantiate the object rather than using AddChild, and set the scale to one before parenting it.  The problem I have encountered is that when the object is rotated using quaternions, that it changes shape, despite every value in the inspector being identical to a non rotated child.

As you can see in this example image from the editor, the only different value in the inspector is rotation.  If I  adjust the scale, it goes back to looking the way it should.  Is this a Unity error?

8
NGUI 3 Support / Re: Material choice breaking dynamic fonts
« on: January 08, 2014, 09:09:30 PM »
I got the clipping working properly by setting the two cameras I am using to the same depth and giving the font a material with the texture from the ttf, although any attempt to use the font included in NGUI resulted in Unity massively slowing down.

Why is there a material slot on labels if it isn't intended to be used?

Also, how do I set up a secondary 2d portion of UI?  I need both elements in world space and elements that make up an on screen menu, and the option to have multiple UIs seems to have been removed, as the creation menu is grayed out once one is created.

9
NGUI 3 Support / Re: Material choice breaking dynamic fonts
« on: January 07, 2014, 12:17:27 PM »
The labels are showing even through completely opaque objects as long as they don't have a material assigned, but assigning a material with a single pixel texture or no texture makes the text illegible.  I have tried playing with changing the depths of the involved cameras, but given some of the constraints I am dealing with, the GUI camera has to be at a higher depth than the game camera.

I've also tried moving the draw calls around in the queue with no effect.

10
NGUI 3 Support / Material choice breaking dynamic fonts
« on: January 06, 2014, 08:34:21 PM »
I just upgraded to the most recent version, and have encountered two errors.  When using 3d UI elements, labels aren't clipped by objects in the scene, but everything else is.  They are all dynamic.  If I assign them a material, they are clipped properly, but they become completely illegible, with each letter expanded into a blob.  Additionally, when the cameras are set up so that the UI camera only sees the UI and the main camera doesn't, nothing clips at all.  I feel like I'm probably missing something, but the only post I could find on the subject said to add a material, which hasn't helped.

11
NGUI 3 Support / Re: Rewind a tween or use the pong of pingpong
« on: October 24, 2013, 07:06:55 PM »
Set whatever you are using to trigger the tween to toggle, as in the button tween script.

12
NGUI 3 Support / Re: UILabel with PlayerPrefs
« on: October 24, 2013, 04:44:52 PM »
Why do you want it to be a static int?  You can just pull from the player prefs once, then when the highscore is beaten, set it to the current score and repeat.

13
NGUI 3 Support / UIGrid objects being offset by huge value
« on: October 23, 2013, 06:23:14 PM »
I have a set up that instantiates new objects to be placed in a grid.  I changed which scene the prefab was placed in, and now when the grid is generated everything is offset by 1000 units in the z axis, which means that everything is out of the view.  I can't find any difference between the two scenes to explain the difference, or what is happening in the instantiation code that could be causing it.  If I move them in play mode, they move back when the grid is moved.

14
NGUI 3 Support / Button tweens sticking
« on: September 30, 2013, 12:17:28 PM »
I am having problems with every type of tween on buttons sticking.  This occurs whether I am using the base button class or extending it to do something specific.  If it is set to slide out, it will stick in it's new position, if the color changes it will stay that color, etc.

15
NGUI 3 Support / Re: Loading GUIs from assetbundles.
« on: September 17, 2013, 12:11:18 PM »
broken,
If you're doing the same thing I am doing, it appears that most or all of the crashing issue was caused by Unity not handling scenes being loaded through assetbundles and not changed out of before the editor closed.  I fixed it by adding a button to switch back to the original scene.

Pages: [1] 2