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

Pages: [1]
1
I'm working on a tutorial scene for my game. I have a script that turns off all colliders of the children in a panel of mine, then I turn on the ones I want active as users go through the tutorial.

I do want the objects to be a specific color when their colliders are disabled so they know they're not clickable (which thankfully, NGUI does standard).

All is fine except it seems when I deactivate an object with the UIButton component, then eventually turn that object's collider back on, the UIButton doesn't automatically leave the 'disabled' state. It'll change once I hover over the object, but I need it to change back to the 'Normal' state when I enable the object's collider.

Any solution to this? 

2
Okay here's the issue:

- I have objects in a grid similar to the Drag Drop example scene; they're in a clipped scroll view with the ability to drag the icons horizontally to go through them.

- Those same icons have a Playmaker FSM that is listening for a 'Press Up' action that activates another object (which I only have there because I want that object to activate when the UI icon is dragged out to my DragDropSurface)

- Any time I press the icon object in the scroll view, it won't execute the NGUI dragging component in the scroll view (so no dragging left or right thru the scrollview), and only activates the gameobject that I want activated when you drag the object to DragDropSurface.

I'm trying to make it so the scroll view/UIDragScrollView script executes first, so if you drag the objects within that panel, it'll listen to that first. If you drag the object out of the panel to the DragDropSurface, it'll execute my playmaker FSM.

Any solutions to this?

3
NGUI 3 Support / UIGrid shifting to the left when I remove object in it?
« on: October 24, 2014, 12:02:11 AM »
Hello all,

Having a strange issue with a ScrollView/Grid set up I have in my scene.

I have a scrollview object as the parent (UIPanel & UIScrollview) and an empty gameobject with UIGrid on it. I have same-sized prefabs instantiated into the grid when user clicks a button. Another button deletes individual prefabs in the grid. Once they're removed, for some reason the UIGrid shifts the Grid object's transform to the left a couple units, each time one is removed.

I call UIReposition and UIPanel refresh after the delete, still no use. Strangely, if I execute the Grid though in the inspector, it returns back to how it should be.

Really strange because I have other grids working totally fine, doing practically the same thing. Any insight on this?

4
NGUI 3 Support / How to use Resources.Load & UIDragDropItem script?
« on: May 29, 2014, 03:58:19 AM »
I currently instantiate various prefabs from a UI Scroll View via the handy, basically automated drag/drop system with NGUI.

I'm trying to instead have the objects loaded as a resource as they're dragged/dropped into the scene, then I'll call a Resources.UnloadUnusedAssets when they're destroyed. The UIDragDropItem script is a bit daunting and I'm not sure where to start, to get them loaded properly at the right time.

Any pointers? I'd appreciate any help!

5
Hey all,

My app is only for iPads. I recently encountered a stressful memory issue with my App that crashes iPad 2's - mostly due to textures/atlases. One solution I found was to create a reference atlas, have all widgets reference the reference, and have separate HD/SHD atlases that will be loaded AS NEEDED based on specific device screen dimensions.

I've looked through most (if not all) related topics and have gotten closer to the answer, but I can't get the build to ONLY include the specified HD or SHD atlas at runtime; it's still loading both into memory.

Background summary: I originally had the SHD atlas, duplicated it and renamed the original as my reference, resized all sprites in the atlas to 1/2 size, created HD atlas out of them, and assigned their pixel sizes accordingly.

I'm using a script I found on the forums and modified it - and all widgets point to the reference atlas. In this context SD really means HD (and HD = SHD) but it was easier to construct this way, since it's iPad only. Do you see anything wrong with this?:

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class AtlasSwapper : MonoBehaviour {
  5.    
  6.     public UIAtlas Reference1;
  7.     private UIAtlas SD1;
  8.     private UIAtlas HD1;
  9.    
  10.     void Awake () {
  11.         GameObject go = Resources.Load("Atlases/Atlas1/SD1", typeof(GameObject)) as GameObject;
  12.         SD1 = go.GetComponent<UIAtlas>();
  13.  
  14.         GameObject go2 = Resources.Load("Atlases/Atlas1/HD1", typeof(GameObject)) as GameObject;
  15.         HD1 = go2.GetComponent<UIAtlas>();     
  16.     }
  17.    
  18.     void Start () {
  19.         if (Mathf.Max(Screen.currentResolution.width, Screen.currentResolution.height) >= 1024)
  20.                 Reference1.replacement = HD1;
  21.         else
  22.             Reference1.replacement = SD1;
  23.     }
  24.    
  25.     void OnDisable()
  26.     {
  27.         Reference1.replacement = SD1;
  28.                 StartCoroutine(RemoveAssets());
  29.     }
  30.        
  31.         IEnumerator RemoveAssets() {
  32.         Resources.UnloadUnusedAssets();
  33.         yield return new WaitForEndOfFrame();
  34.         }
  35. }
  36.  

I'll feel silly if it's an easy fix but for now, I can't get it to work, so I'd really appreciate any insight/help.

6
Hey guys,

I upgraded my project successfully to NGUI 3.0.8 f4 from 2.6.4, however all of my previous UITextures (now UISprites) are far too large, and even some of my basic widgets are resized. Does this have to do with the new Dimensions field in the Inspector?

I didn't follow perfect rules for anchoring in the past, but it worked great prior to this upgrade. My UI Root is still at 1536 fixed size as before.

I'm sure I could just go to a backup of mine and resize all of the UI components again to how they were before, but that'd take a couple hours. Anyone have this issue & find a solution?

7
Hey guys,

I'm in a pickle. I have an NGUI sprite with two animations: Show & Hide (they just move the sprite on and off screen on the X coordinate). I'm trying to link them to a 3D object that's created from a prefab, so when the object is tapped, the "Show" animation plays.

Even further, I'm trying to set it up so if anything OTHER than the object is pressed, the animation "Hide" will play.

Do you guys know if this is possible and how I may go about figuring it out? I'm at my wit's end at the moment and it seems so simple - but I'm not incredibly experienced so I can't quite figure it out. Any help would be appreciated!

8
NGUI 3 Support / Drag & Drop prefab: keep animation?
« on: August 02, 2013, 10:58:33 AM »
I have the drag & drop system working in my scene, but when I drag the UI item out onto the drag & drop surface, the 3D object doesn't properly play the animation I have hooked up to my slider. Any thoughts on how to link the prefab clones up properly? I'm also using Playmaker.

9
Hi guys,

I'm using the DragDrop functions and have it all set up in my scene. However, after I drag the DragDropItem UI item onto the DragDrop surface & the prefab is initiated, my UI item button disappears.

Is there a way to keep the DragDrop UI item active and continuously spawn new clones of the prefab it's connected to? i.e. click & drag UI item onto surface & generate 3D model, click UI item again and drag UI item onto surface & generate duplicate 3D model, etc. etc.

Your help would be very appreciated!

Pages: [1]