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

Pages: [1] 2
1
NGUI 3 Support / Re: NGUI Unity 2017.3 ScrollRect Support
« on: January 14, 2018, 05:09:53 PM »
Update2: This is nothing to do with ScrollRect, other than the fact that it looks like Raycasts are screwed up in 2017.3 and the behaviour changes when the mouse is down (!!!) - setting a screen size of fixed resolution in gameView (e.e.g FWVGA Portrait 480x854) rather than an aspect ratio results in everything working correctly.

It sounds liek something similar has happened in the past, based on the comment in NGUIToolscs:1991.

//#if UNITY_EDITOR_OSX
               // There seems to be a Unity 5.4 bug that returns invalid screen size when the mouse is clicked (wtf?) on OSX
               //if (mGameSize.x == 1f && mGameSize.y == 1f) mGameSize = s_GetSizeOfMainGameView();
.


2
NGUI 3 Support / Re: NGUI Unity 2017.3 ScrollRect Support
« on: January 14, 2018, 04:07:37 PM »
I should note that Example 14 - Endless Scroll Rect, doesn't work out of the box with 2017.3 using the editor. From looking at the display, I think this is something to do with how screen extents are computed (and seems to be tied to whether the mouse is moving over the gameview.)

3
NGUI 3 Support / NGUI Unity 2017.3 ScrollRect Support
« on: January 14, 2018, 04:05:10 PM »
After upgrade to Unity 2017.3, it looks like scrollrects never register clicks anymore (they always interpret drag events), and we have myriad issues with colliders.

Whilst we can debug NGUI to deal with this (and the result will probably still be more usable than the disaster that is official Unity UI with dynamic layouts, endless srolling and integrated 3D models in the UI), it would be great to know if anyone is actively using NGUI with 2017.3, and/or if there will be an official update.

4
NGUI 3 Support / Moving back to NGUI - Unity Sprite Support
« on: October 13, 2017, 05:07:24 PM »
After 18 months of using Unity UI, we are strongly considering reverting to NGUI for our next app. We do relatively complex app layout (nested panels, etc as opposed to just game menus) and Unity UI seems to be a broken minefield of undocumented scrollview and autolayout nastiness, augmented by a bunch of half arsed community scripts on unity forums by people who really don't understand what they're doing.

The only thing about Unity UI we like is the sprite atlas system (just rect sprites are fine, but we like the flexibility of Unity's texture format choices when packing for optimization, rather than trying to manually create e.g. PVRTC, 16-bit and 32-bit atlases.) We also like the intuitive-ness of using the hierarchy to control sprite draw order. Is it now possible to use Unity Sprites throughout your NGUI widgets and use the hierarchy to manage depth, or is this not advised?

5
NGUI 3 Support / atlases caching redundant references to prefabs.
« on: January 18, 2015, 04:41:46 PM »
We are trying to optimize memory usage by ensure that specific screens (UIPanels) are only loaded, and thus there atlases are only loaded, when we require them.

I've tried this with various versions of NGUI, and there seems to be some way in which UISprites preserve incorrect references to atlases. It is extremely difficult to permanently remove all references to an atlas in the build player such that the atlas does not get loaded at all.

For example, we have one scene where we have three large atlases, each references by separate UIPanels. We have moved each panel to a separate Prefab, which is resource.Load()ed. We have also confirmed in the editor at runtime that right-clicking the unused atlases and selecting "Find References in Scene" returns no unexpected references, even after the prefab is instantiated. We have also confirmed that dragging the prefab into the scene and checking for references has no dangling references.

However, when building the player (for iPhone), all prefabs still incorrectly drag in all atlases.

I can give more details, and yes I do really know my stuff about Unity memory management, but would like to ask whether your aware of sprites caching redundant references to atlases before going into more detail.

There used to be a very similar case in NGUI 2.x (and it may still exist in 3.x) where the following sequence:

1. Switch an atlas to a reference.
2. Reference a half-sized version of the atlas.

Would still leave references to the full-sized atlas, although I'm not sure this is related, since in that case I suspect what happened was the Reference Atlas still held a dangling material reference.

I am quite happy to hand-edit prefab files to remove atlas references if that's required.

Alex

6
NGUI 3 Support / Redundant references to UIAtlas Prefabs
« on: January 15, 2015, 01:24:41 AM »
Our scene seems to contain many dead references to atlases from bits of UI that may at some time have referenced that atlas.

We are trying to clean the scene up so that we can Resource.Load() prefabs of sub-screens, and have the atlases for those sub-screens pulled in by sprite references in that screen only. However, in all cases right-clicking in project view and "find references in scene" shows many UI objects referencing the atlas, even though they clearly don't. Additionally, building the project for device shows the atlas is loaded immediately at startup.

I can prove the references are to the atlas not the texture (which is the thing we actually care about not loading, because it's 4k-square, and yes we have that much retina-res UI) simply by cloning the atlas, deleting the old one, and confirming that there are now zero references to either the atlas or the texture.

Where are references to UIAtlases held, and how do we clean them up? I'm happy to editor script this if required, but can't understand where the references are from.

7
We have several buttons which result in launching external iOS dialogs. Most of these call UnityPause(), which in turn results in OnApplicationPause() being called, which then makes a second call into Objective-C functions that aren't safely re-entrant (i.e. displaying a viewcontroller again.)

It's a lot of work to fix up all of these functions (which we didn't write.) Can we safely prevent this duplicate call?

Thanks,
Alex

8
NGUI 3 Support / Fixed-size scrollbar foregrounds (handles)
« on: May 30, 2013, 12:39:23 PM »
Hey Aren,

I want to make a fixed-size (vertical) scrollbar handle, i.e. the scrollbar handle is always a fixed-size sprite (actually 40x40).

The interaction between UIScrollbar and UIDraggablePanel is relatively complex by NGUI standards, so I wanted to ask if there's a simple way to do this, as I couldn't see an easy one just by forcing, say, UIScrollBar.barSize somewhere.

Is there an elegant way to do this? I can make the blob the right size outside of NGUI just by adding a funciton with a lateUpdate to rescale the scrollbar, but then it won't move the full length of the scrollbar (because it stops when the bottom of the scaled widget would have hit.

Thanks,
Alex

9
I can confirm that I'm using clipped textures to display a clippedpanel with a scrolling window of UIPicture thumbnails (effectively scrolling directory view with UITextures as file buttons) and that I needed to make that change even if calling MarkAsDirty after constructing a new unique material for each button and setting its texture.

Alex

10
NGUI 3 Support / Re: HardClipping with Custom UITexture Shader
« on: May 02, 2013, 05:49:21 PM »
Almost... The material has multiple properties and textures, which get updated. Not every frame, but frequently. And mClippedMat doesn't pick them up.

With my sledgehammer, I can make something that looks correct, by doing this in OnWillRenderObject().

      if (mClippedMat != null)
      {
         mClippedMat.CopyPropertiesFromMaterial(mSharedMat);

What would be the correct / efficient way to do this?

11
NGUI 3 Support / HardClipping with Custom UITexture Shader
« on: May 01, 2013, 07:36:28 PM »
Hey Aren,

Quick question before I do some coding: If I have a UITexture with a custom shader in a hardclipped panel, and I implement a hardclipped version of my shader (transform worldpos, call hlsl clip()) and name it correctly should everything "Just work"?

12
Cool.

You previously mentioned that if you do this in the editor, you'll need to keep the atlases in sync. Since the Atlas is purely a duplicate of another atlas, and the sprites are purely duplicates of existing sprites, can I just instantiate both at runtime by cloning the existing assets, or is there code that relies on the atlas being created up-front?

Alex

13
I have a radio-button-controlled group of sprites, and need to highlight the selected one by brightening it. I don't want to create an extra "highlighted state" sprite of each as there are many of them. One way to implement this is a custom shader drawing an additive 20% transparency mask of the selected sprite over the top of itself (i.e. a shader mode of (one, one), and colour-add 20% of the sprite's alpha channel.)

It doesn't matter that this is an extra draw call as long as it happens after the base sprites draw call.

How can I do this? Do I have to duplicate the atlas, then change the shader on the atlas (I assume here that both atlases can reference the same texture.) Or is there another way? I would really rather NOT move to UITextures, where applying custom shader is easy, as there are many of these sprites, and sorting is complex.

Alex

PS. I also tried scaling the colour up using a colour tint. But NGUI uses Color32 for vertex colours so this doesn't work out of the box as the sprites are white by default. I switched back to the old codepath (for Unity 3.5.4) using float colours but surprisingly this didn't work.

PPS. Leave aside that this won't highlight things that are already close to 1.0 in RGB space very well. I know...

14
NGUI 3 Support / Momentary Flicker when Switching Menus
« on: November 30, 2012, 06:41:13 PM »
I'm working on porting "Paint My Cat" to iPhone and iPod touch, and am seeing a momentary flicker (nothing renders in the UI camera) when switching panels (which may have always been there but not noticeable until I ported to slower devices).

My panel switching between menus is accomplished using the world's most naive menu stack system. Like this:
   
       NGUITools.SetActive(previousPanel.gameObject, true);
            NGUITools.SetActive(currentPanel.gameObject, false);

Is there some other practice that I should be using when switching menus to avoid this?

Thanks,
Alex

15
NGUI 3 Support / Scaling (incorrectly) UICamera to always fill screen
« on: October 29, 2012, 11:22:12 PM »
Hi,

I'm shipping an iPad game, and all my UI is at 4:3 res (1024x768.)

It also runs fine on my phone, and at some point there will be a proper release on the phone. But that will require more work than just rescaling the UI (there are usability and space tweaks.)

In the meantime, I'd like to be able to just display the UI full-screen, when running on an iPhone rather than iPad. THis will mean the UI is stretched on 4/4S, and very stretched on 5. But I'd just like it to fill the screen and remain functional so I don't have the bars at the side.

Is there a quick way to do this with UICamera before I start writing my own scaling logic/rubbish?

THanks,
Alex

Pages: [1] 2