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.


Topics - Dune

Pages: [1]
1
NGUI 3 Support / Bug - UpdateAnchors called on object after OnDestroy
« on: October 29, 2016, 12:57:29 AM »
This may be a Unity bug, but I thought I should post it here since I'm finding it while working on a custom NGUI class.

A problem is arising after the object is destroyed. OnDestroy() is called, and then another UpdateAnchors()

I cannot use a flag in OnDestroy, because after the OnDestroy is called, all the values for the object are reset.

Here's a simple class to test this.
  1. public class testCallOrder : MonoBehaviour
  2. {
  3.     void Awake()
  4.     {
  5.         Debug.Log("Awake");
  6.     }
  7.  
  8.     void Start()
  9.     {
  10.         Debug.Log("Start");
  11.     }
  12.  
  13.     void OnDestroy()
  14.     {
  15.         Debug.Log("OnDestroy");
  16.     }
  17.  
  18.     public void UpdateAnchors()
  19.     {
  20.         Debug.Log("UpdateAnchors");
  21.     }
  22. }
  23.  

Put this in a NGUI sprite, run the game. Expand the game window to maximum, then quit the game.

2
NGUI 3 Support / Anchor Rotated Button - Help!
« on: October 22, 2016, 12:21:35 AM »
Having troubles anchoring a rotated button. Setting anchors in editor or in code not having the desired effects. I'd hoped that when rotated (90 degrees clockwise), that left would now be top, top-right, right-bottom, and bottom-left. But then you can't anchor bottom to left / right handles on non-rotated objects in the editor. And if your pretend bottom is the left, ie treat it as left, it doesn't work that way either.

Help!

I can return to my old pre-NGUI way of handling it, don't rotate the button, but create a texture that is rotated in the paint program, and use it in a tall and narrow button. But I'd hoped, when I rotated the NGUI button and the text had rotated easily along with it, that anchoring would go along with it. No luck so far.


Pages: [1]