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

Pages: [1] 2
1
NGUI 3 Support / Re: Bug - UpdateAnchors called on object after OnDestroy
« on: October 30, 2016, 03:06:44 PM »
The call-stack is:

>   Void SeaRisen.testCallOrder:UpdateAnchors ()+0x0 at C:\Users\Chuck\Desktop\_Unity\Projects\Game\Demo1\Assets\testCallOrder.cs:32   C#
    Void UnityEngine.Component:BroadcastMessage (String, SendMessageOptions)+0x4 at C:\buildslave\unity\build\artifacts\generated\common\runtime\UnityEngineComponentBindings.gen.cs:255   C#
    Void UIRoot:UpdateScale (Boolean)+0xa0 at C:\Users\Chuck\Desktop\_Unity\Projects\Game\Demo1\Assets\NGUI\Scripts\UI\UIRoot.cs:290   C#
    Void UIRoot:Update ()+0x31 at C:\Users\Chuck\Desktop\_Unity\Projects\Game\Demo1\Assets\NGUI\Scripts\UI\UIRoot.cs:266   C#

2
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.

3
NGUI 3 Support / Re: I2 SmartEdge is now in BETA
« on: October 28, 2016, 02:25:31 PM »
Can the text be rotated, without you know rotating the control it sits on? Which breaks anchors / layouts.

4
NGUI 3 Support / Re: Mouse cursor resetting to center screen on move?
« on: October 28, 2016, 01:34:54 AM »
With "Auto Hide Cursor" on or off, pressing any movement (WASD) and the cursor appears / disappears for no apparent reason. Making movement jerky. And the cursor is warped to the center of the screen.

Any ideas to what could be causing it?

I've disabled my player controller, to be sure it isn't my code.

5
NGUI 3 Documentation / Re: Tweens
« on: October 23, 2016, 07:18:54 PM »
I noticed this code in TweenWidth. Did you know about the ?? operator? The ?? operator says, "if the value on the left is null, use the value on the right."

  1. public UIWidget cachedWidget { get { if (mWidget == null) mWidget = GetComponent<UIWidget>(); return mWidget; } }
  2. // replace with ...
  3. public UIWidget cachedWidget { get { return mWidget ?? (mWidget = GetComponent<UIWidget>()); } }
  4.  

6
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.


7
NGUI 3 Documentation / Re: UISprite
« on: October 21, 2016, 03:44:48 PM »
Never mind on that. I was targeting the wrong UISprite. Didn't notice until now that I was losing the parent sprites "Flat Outline."

Here's the updated code if anyone's interested...

  1. public void SetCharacterInfo(CharacterInfo info)
  2. {
  3.     this.CharacterInfo = info;
  4.     var image = GetComponentsInChildren<UISprite>()
  5.         .First(sprite => sprite.transform.name == "Image");
  6.        
  7.     //var atlas = image.atlas;
  8.     image.spriteName = info.sprite.name;
  9.  
  10.     var label = GetComponentInChildren<UILabel>();
  11.     label.text = transform.name = info.name;
  12. }
  13.  

8
NGUI 3 Support / Re: Mouse cursor resetting to center screen on move?
« on: October 21, 2016, 04:15:45 AM »
I tried this, but then my OnClick events stopped working.

9
NGUI 3 Documentation / Re: UIGrid
« on: October 21, 2016, 12:49:46 AM »
People for the last two years have asked for an align / anchor for the grid, and I've seen the replies, that UIGrid has no positioning. And that is true, it doesn't. But the GameObject it is loaded into does. Should I instead AddComponent the UIGrid onto the same GameObject as the UIScrollView? (edit: tried this, it didn't work)

When I run the game normally, it is fine, but when I resize the game window to maximum the grid pops off the Scroll View and all my items are hidden. If then in the scene view I grab the arrow control (W) and drag the grid's GameObject back to the scroll view, I can see my items. Since I have to use W to move the grid, it appears it has alignment.

What is the right solution?

Edit - Maybe found a solution, but now I can't scroll the scrollview...

Added a widget as a child of the Scroll View. Widgets have Anchors.
Then added the grid's GameObject as a child of that. Moved it to the desired position.
Removed the grid.Reposition() I was calling in script and the sv.ResetPosition() I was calling before and after the AddChild instantiates.
Run & Resize, the grid stays anchored in place.


10
NGUI 3 Documentation / Re: UIScrollView
« on: October 21, 2016, 12:20:34 AM »
It turns out I needed to adjust the grid's cell sizes, and re-execute. But yeah, the scales are strange. I started over with a new project.

I've managed to follow most of tutorial 4. All except for being able to drag onto the single square, at the 12 minute mark on YouTube. See my comment there -

https://www.youtube.com/watch?annotation_id=annotation_4134838683&feature=iv&src_vid=jDxWG81sNPc&v=UK3aMHRfgcw

11
NGUI 3 Documentation / Re: UISprite
« on: October 21, 2016, 12:16:59 AM »
Having trouble getting the sprite to change for instantiated sprite.

  1. public void SetCharacterInfo(CharacterInfo info)
  2. {
  3.     this.CharacterInfo = info;
  4.     var image = GetComponentInChildren<UISprite>();
  5.     //var atlas = image.atlas;
  6.     image.spriteName = info.sprite.name;
  7.  
  8.     var label = GetComponentInChildren<UILabel>();
  9.     label.text = transform.name = info.name;
  10. }

Everything else updates alright. I've verified that the atlas is correct, and the names match. Do I have to call a refresh of some kind on the sprite?

12
NGUI 3 Documentation / Re: UICamera
« on: October 19, 2016, 05:05:40 PM »
Figured out that I could change size of icon via the drop down Gizmos.

13
NGUI 3 Documentation / Re: UIScrollView
« on: October 19, 2016, 03:22:12 PM »
Struggling with the tutorial. So many things go wrong. Here's some screenshots when I add the Grid, put the sprites in it and then click Execute.





Edit. Looking things over, the Grid has an XYZ scale of 205.5 and UI Root's XYZ scale of 0.004866, I'm sure that's messing with stuff. But I can't change the UI Root's scale to 1,1,1. They don't change from the 0.004866.

14
NGUI 3 Documentation / Re: UIScrollView
« on: October 19, 2016, 02:15:19 PM »
Can't right click on any NGUI object to get the context menu as you do in your videos. And left click to select is very difficult. I have to click dozens of times to get it. I usually revert to using the hierarchy to select.

15
NGUI 3 Documentation / Re: UIScrollView
« on: October 19, 2016, 02:03:43 PM »
Following Tutorial 4...

Couldn't right-click on the camera or background to do the create. Had to use the top-bar NGUI menu.

Then I had a hard time getting the resize dots to appear, but now that I have them I cannot drag and resize the ScrollView as seen in the tutorial. The size only resizes by 2 pixels for a long drag. Then another 2, etc.

Just deleted the ScrollView and created another, and it's working fine. Thought I'd report the strange behavior.

Pages: [1] 2