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

Pages: [1] 2 3 4
NGUI 3 Support / Re: Allow UIButton and UIInput to receive a click.
« on: September 23, 2016, 05:28:05 PM »
OK here's a link to a pastebin of it.

NGUI 3 Support / Re: Allow UIButton and UIInput to receive a click.
« on: September 21, 2016, 01:46:03 PM »
Thanks for this! It worked great. I set a tag on the game objects that I want to be able to click and check that tag in the OnSelect delegate.

(When I tried to post the code I wrote as an example I got this error. "You don't have permission to access /forum/index.php on this server"
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.)  :o

NGUI 3 Support / Allow UIButton and UIInput to receive a click.
« on: September 16, 2016, 09:44:56 AM »
I have a UIButton that interacts with my custom UIInput. When the user clicks outside of the UIInput, I want to hide that UIButton, unless, the click was on the UIButton. It's pretty important for the functionality of my input. I don't want to have all the extra buttons showing unless the user currently is interacting with the input.

protected override void OnSelect(bool isSelected)


The problem is, the UIInput receives the click first, which disables the UIButton and prevents it from ever being able to receive a click. I've tried setting alpha to 0 and scale to 0, and other such tricks, but nothing seems to work. How can I implement this?

NGUI 3 Support / Re: Why does UICamera hide the mouse cursor?
« on: July 08, 2015, 09:55:58 AM »
I commented out the same lines relating Cursor.lockState and Cursor.visble. Yes my Navigation X and Navigation Y are set to Horizontal and Vertical respectively, and my Horizontal and Vertical take joystick input. I can kind of see why you would want to have special joystick configurations, but it seems to me that the default should treat the joystick like a mouse.


NGUI 3 Support / Why does UICamera hide the mouse cursor?
« on: July 03, 2015, 10:26:44 AM »
Why is there code in UICamera that arbritrarily turns on and off the mouse cursor? This resets the cursor position and makes it so that my player character cannot walk and move the mouse cursor at the same time. I've had to comment out the Cursor.visible = true and Cursor.visible = false lines in UICamera to get my game working again.

NGUI 3 Support / Serious issue with UIInput and tab selection
« on: June 20, 2015, 12:47:59 AM »
It appears that recently support for selectOnTab was removed from UIInput and converted into UIKeyNavigation. This did not work consistently on Password fields for me and resulted in 19 times out of 20, the ui field not being selected. My registration page goes user name, password, email; so this was really bothersome for me. Because you are secretly serializing the selectOnTab field, this was even harder for me. I don't remember setting those tabs, but this is pretty disappointing. I made an alternative script to set up how I need it since UIKeyNavigation does not work properly for Password field. Here it is for anyone who wants to manually override their navigation to support tabs. Remember that if you are having this problem, you must open your scene in a text editor and delete all instances of selectOnTab. ArenMook, I believe you should print out warnings for each time you manually add the UIKeyNavigation for users with the legacy setup.

  1. using UnityEngine;
  2. using System.Collections;
  4. [RequireComponent( typeof(UIInput))]
  5. public class OverrideOnTab : MonoBehaviour
  6. {
  7.     public UIInput selectOnTab;
  8.     private UIInput input;
  10.     private bool readyToSelect;
  12.     void Awake()
  13.     {
  14.         input = GetComponent<UIInput>();
  15.     }
  17.     void Update()
  18.     {
  19.         if (input.isSelected && Input.GetKeyUp(KeyCode.Tab))
  20.         {
  21.             StartCoroutine(SelectAfterUpdate());
  22.         }
  23.     }
  25.     IEnumerator SelectAfterUpdate()
  26.     {
  27.         yield return new WaitForEndOfFrame();
  28.         selectOnTab.isSelected = true;
  29.     }
  31. }

I'm on 3.7.9

I also could not get the issue to happen in a small test project, but I don't want to have to send you my entire project. I believe the issue relates to line 1827 of UICamera, but I don't know how this line of code I suggest would affect mobile devices. This line is being called on key up from the keyboard, and I believe that means it should not be thinking about the whole dragged and touched things. Adding isMouse here fixes my issue, but it's something you should only add if you take a look and think it was a neglected line. Maybe a return was missing up above when the event was handled properly for the keyboard.

What if you made line 1827 of UICamera "if ((currentTouch.dragged == currentTouch.current && isMouse)  ||"   

Thank you for looking! I'll see if I can make a similar test project when I get home tonight that does exhibit the issue. I will pm the project to you.

agreed. maybe just take a look at the stack trace and you could notice a small bug. The Button OnClick is certainly being triggered without my clicking the button.

The problem is this. I click a button, btnA. I then click into a UIInput, inptA and press enter to submit. The submit delegate associated with the inptA is called, and the camera also triggers a click on btnA. It should only call the delegates for inptA since btnA is in no way related to OnSubmit for inptA. However, this is not the case, and that is why I'm having to manually clear the current object (btnA) from the camera.

Do you think though that when I submit to a text box, that the last button I pressed should not also be submitted?

NGUI 3 Documentation / Re: UIInput
« on: February 04, 2015, 12:47:05 AM »
I do understand that it was a big change in Unity, but as per your advice I always keep everything up to date to the bleeding edge.

I have a button click that calls this function.

  1. public void InsertEmoji(string text)
  2.         {
  3.             Debug.Log("Inserted EMOJI");
  4.             //UIButton.current = null;
  5.             Insert(text);
  7.             //Hack because the camera is not clearing this selection
  8.             UICamera.selectedObject = null;
  10.             //Reselect the input
  11.             OnSelect(true);
  12.             UpdateLabel();
  13.         }

Sometimes after I click the button, I click the chat box and press enter to submit the text. This function gets called again for some odd reason. I just wanted to note this in case you might find a simple reason why it's happening. For now my fix is to manually set the UICamera.selectedObject to null as you can see in my code. That seems to fix the issue. Here is my stack trace.

Consortya.ChatInput:InsertEmoji(String) (at Assets\NGUI_Consortya\Scripts\ChatInput.cs:34)
Emoji:InsertSmile() (at Assets\NGUI_Consortya\Scripts\Emoji.cs:38)
EventDelegate:Execute() (at Assets\NGUI\Scripts\Internal\EventDelegate.cs:476)
EventDelegate:Execute(List`1) (at Assets\NGUI\Scripts\Internal\EventDelegate.cs:644)
UIButton:OnClick() (at Assets\NGUI\Scripts\Interaction\UIButton.cs:257)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
UICamera:Notify(GameObject, String, Object) (at Assets\NGUI\Scripts\UI\UICamera.cs:1079)
UICamera:ProcessTouch(Boolean, Boolean) (at Assets\NGUI\Scripts\UI\UICamera.cs:1851)
UICamera:ProcessOthers() (at Assets\NGUI\Scripts\UI\UICamera.cs:1602)
UICamera:Update() (at Assets\NGUI\Scripts\UI\UICamera.cs:1262)

NGUI 3 Documentation / Re: UIInput
« on: January 29, 2015, 01:48:34 PM »
After looking into my build, I am also on 3.7.9. It's just that the Readme does not show the version num 3.7.9. Perhaps you need to look at Unity 4.6.1. Are there any Keyboard inputs that I may have set in my Unity project that would override your functionality for ctrl+a

Pages: [1] 2 3 4