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

Pages: [1] 2 3 4
NGUI 3 Documentation / Re: UIToggle
« on: October 29, 2015, 03:43:55 AM »
Thanks for the response, have found it which is simply:

UIToggle B1Tog = GameObject.Find("B1").GetComponent<UIToggle>();
B1Tog.value = false;

NGUI 3 Documentation / Re: UIToggle
« on: October 23, 2015, 03:45:27 AM »
We have 3 windows, each of which have their own buttons which run a tween to open and close them. The buttons also have a toggle to highlight or not depending on whether the window is open or closed.

Each button can also close either of the other windows if the are open, by running the other window's tween.

The problem is how to control the toggle on the button associated with the "other" windows.

I can't see how to do this using standard NGUI features, and after having been through all the posts on here but don't see how to control the state of a toggle from script.

Thanks in advance for any suggestions.

NGUI 3 Support / Re: Changing Anchor Offset in UIWidget from code
« on: July 01, 2015, 04:11:26 AM »
Scratch that, after a load more hunting around is actually pretty simple:

....gameObject.GetComponent<UIWidget>().topAnchor.absolute = 300;

NGUI 3 Support / Changing Anchor Offset in UIWidget from code
« on: June 30, 2015, 04:48:39 AM »
Trying to change the circled value from code with no luck, any suggestions?


Thanks in advance for any assistance.

NGUI 3 Support / Re: Extending UICamera to add a new type of Event Source
« on: January 15, 2015, 06:39:16 AM »
Thanks, we have this partially working using onCustomInput but.....

We use the event system in UICamera to drive a lot of UI not just NGUI menus. As far as we can see UICamera is only designed to work with input devices with 2 degrees of freedom e.g. a mouse, touch, controller. A zSpace stylus has 6 degrees of freedom (and some new VR controllers I think have more - 2 hands) so we don't see a clean way of integrating this into UICamera without really rewriting quite a bit of it's internals.

Any suggestions?

Just upgraded to 3.7.8 from 3.7.4 and this change does seem to fix it. Thanks

NGUI 3 Support / Extending UICamera to add a new type of Event Source
« on: January 09, 2015, 12:43:29 PM »
We need to add support for a zSpace stylus as an NGUI Event Source, so an existing menu system built in NGUI can work with it.

Does anyone know if any one has done this before for other custom controller types?

Any pointers ?

Thanks in advance.

After a day debugging (yay!) why another NGUI upgrade (3.7.4) breaks our stuff again ( ), it appears that this new option re events to colliders or rigidbodies, is only set on the First Camera and it's always FALSE on all other cameras, even though it can only be set on the First camera.

NGUI 3 Support / Re: Scrollable Text Area
« on: September 11, 2014, 11:55:50 AM »
Still trying to work out how to keep the cursor and/or text the user is typing in view.

Wondering if an approach might be to try and tie UIInputs cursor position to the UIScrollView or to the Scrollbars position. Sort of like UICenterOnChild but for the cursor.

Not seen anything anywhere in this area. Does anyone know if anything exists ?

NGUI 3 Support / 3.7.0 (and 3.7.1) breaks hover reporting in World_3D
« on: September 10, 2014, 03:53:59 AM »
Further to this:

3.7.0 also added:

               Rigidbody rb = hoveredObject.GetComponentInParent<Rigidbody>();
               if (rb != null) hoveredObject = rb.gameObject;

in UICamera Raycast, which means that hover is no longer reported on objects within the hierarchy of an object with a rigidbody. This means if you have a complex object with different parts within it, hover now only reports the name of the top object, as you move the mouse around.

Can this be reverted to how it worked in NGUI 2 and NGUI 3 up to 3.6.8 please ?

NGUI 3 Support / Re: Event Delegate for UICamera.onHover
« on: September 10, 2014, 02:47:03 AM »
Thanks, but the post was an example of what had tried and works for onPress from UIEventTrigger. The approach does not work for UICamera.

We do a lot of processing in UICamera.genericEventHandler which is now warning that it is deprecated and delegates are to be used, but we have not managed to get this working or find an example of how to do it.

Any clues ?

NGUI 3 Support / Re: Assign EventDelegate and Parameters from script
« on: September 09, 2014, 12:45:49 PM »
After lots of hunting this worked for me. It passed a reference to the UIButton script itself as the parameter.

        UIButton theBtnScript = theBtn.GetComponent<UIButton>();
        EventDelegate del = new EventDelegate(); = this;
        del.methodName = "NGUI3ButtonClickHandler";
        EventDelegate.Parameter theParameter = new EventDelegate.Parameter(theBtnScript, "ITEM_VALUE");
        del.parameters.SetValue(theParameter, 0);
        EventDelegate.Set(theBtnScript.onClick, del);

NGUI 3 Support / Event Delegate for UICamera.onHover
« on: September 09, 2014, 12:44:19 PM »
Trying to register for OnHover events from UICamera in script.

The below works for UIEventTrigger but can't get it or variations thereon to work for UICamera.

            UIEventTrigger theButtonUIEventTriggerScript = theBtn.GetComponent<UIEventTrigger>();
            if (theButtonUIEventTriggerScript == null) theButtonUIEventTriggerScript = theBtn.AddComponent<UIEventTrigger>();
            EventDelegate del2 = new EventDelegate();
   = this;
            del2.methodName = "NGUI3ButtonPressHandler";
            EventDelegate.Parameter theParameter2 = new EventDelegate.Parameter(theButtonUIEventTriggerScript, "ITEM_VALUE");
            del2.parameters.SetValue(theParameter2, 0);
            EventDelegate.Set(theButtonUIEventTriggerScript.onPress, del2);

Checked the vids and they don't seem to cover this. Anyone know how you do it ?

Thanks in advance.

NGUI 3 Support / Number of font limit on select a font show all
« on: September 08, 2014, 06:34:00 AM »
Trying to create a new bitmap font, on a machine with 1340 fonts on it.

When you press "show all" on the Select a font window, the button disappears and never showed any fonts. I left it 15 mins on an i7.

Is there a limit ?

NGUI 3 Support / Re: Scrollable Text Area
« on: September 04, 2014, 06:31:07 AM »
There were always 2 issues causing errors, both of which are fixed, but we still have a problem with the functionality.

Error Issue 1. Trying to reference the UpdateScrollbars() function directly, which caused the "Could not find method 'UpdateScrollbars' on UIScrollView" error and was fixed by the below:

    void Awake()
        theViewEventHandler = ViewEventHandler.Instance;

        theInputScript = theInputGO.GetComponent<UIInput>();
        theInputUIEventTriggerScript = theInputGO.GetComponent<UIEventTrigger>();

        theScrollView = theScrollViewGO.GetComponent<UIScrollView>();

        //invalidate the scroll view's bounds in the input field's OnChange notifications
        EventDelegate.Set(theInputScript.onChange, OnUIInputChange);
        //listen for the UIInputs selection so other keys processing can be disabled
        EventDelegate.Set(theInputUIEventTriggerScript.onSelect, OnUIInputSelected);
        EventDelegate.Set(theInputUIEventTriggerScript.onDeselect, OnUIInputDeselected);

    private void OnUIInputChange()

Error Issue 2. If you add a call to the UIScrollView/Drag method from a UIScrollBar On Value Change you get 4 run time errors. See image. This call has been removed and the errors have gone.

So it's all working apart from: Trying to keep the text in view as you type and it goes off the button of the scrollview.

Pages: [1] 2 3 4