Author Topic: [SOLVED]Error with 3.0.3g - UIInput and validator  (Read 6675 times)

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
[SOLVED]Error with 3.0.3g - UIInput and validator
« on: November 02, 2013, 03:52:43 AM »
So I just upgraded from 3.0.2 to 3.0.3g and got this error:

Quote
Assets/NGUI/Scripts/Interaction/UIInputValidator.cs(31,49): error CS1061: Type `UIInput' does not contain a definition for `validator' and no extension method `validator' of type `UIInput' could be found (are you missing a using directive or an assembly reference?)
« Last Edit: November 03, 2013, 10:54:37 AM by BehindTheStone »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Error with 3.0.3g - UIInput and validator
« Reply #1 on: November 02, 2013, 08:04:29 AM »
UIInput.onValidate

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Error with 3.0.3g - UIInput and validator
« Reply #2 on: November 02, 2013, 08:08:37 AM »
I don't understand that. Where do I have to use this?

  1.         void Start () { GetComponent<UIInput>().validator =  UIInput.OnValidate; }
  2.  

Gives me this result:

Quote
Assets/NGUI/Scripts/Interaction/UIInputValidator.cs(30,70): error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected

and still

  1. Assets/NGUI/Scripts/Interaction/UIInputValidator.cs(30,49): error CS1061: Type `UIInput' does not contain a definition for `validator' and no extension method `validator' of type `UIInput' could be found (are you missing a using directive or an assembly reference?)
  2.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Error with 3.0.3g - UIInput and validator
« Reply #3 on: November 03, 2013, 08:54:52 AM »
Use the same code you were using before, just replace "validator" with "onValidate".

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Error with 3.0.3g - UIInput and validator
« Reply #4 on: November 03, 2013, 10:35:17 AM »
You mean like this?

  1.         void Start () { GetComponent<UIInput>().onValidate = Validate; }
  2.  


Doing that gives me these two errors:

Quote
Assets/NGUI/Scripts/Interaction/UIInputValidator.cs(31,49): error CS0123: A method or delegate `UIInputValidator.Validate(string, char)' parameters do not match delegate `UIInput.OnValidate(string, int, char)' parameters

Quote
Assets/NGUI/Scripts/Interaction/UIInputValidator.cs(31,49): error CS0428: Cannot convert method group `Validate' to non-delegate type `UIInput.OnValidate'. Consider using parentheses to invoke the method

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Error with 3.0.3g - UIInput and validator
« Reply #5 on: November 03, 2013, 10:38:35 AM »
Yes. You need to change the signature of your validation function to have an extra parameter:
  1. string text, int charIndex, char addedChar

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Error with 3.0.3g - UIInput and validator
« Reply #6 on: November 03, 2013, 10:42:44 AM »
Yep, that did the job. But I didn't mess around with this script or any of the NGUI-Scripts. Just imported the 3.0.3 Version, so is this a bug which will be fixed in the next 3.0.X release?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Error with 3.0.3g - UIInput and validator
« Reply #7 on: November 03, 2013, 10:43:33 AM »
No, it's not a bug. The functionality simply changed. How it is now is how it will stay.

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Error with 3.0.3g - UIInput and validator
« Reply #8 on: November 03, 2013, 10:44:56 AM »
Yeah, I get that, but do I have to edit this script everytime I import future releases?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Error with 3.0.3g - UIInput and validator
« Reply #9 on: November 03, 2013, 10:49:24 AM »
I just re-read the original post and noticed that you mentioned UIInputValidator... UIInputValidator was removed in 3.0.3. Check the version notes.

You need to follow upgrading instructions from the readme that involve deleting the NGUI folder, or you will always have issues like these when scripts get removed.


BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Error with 3.0.3g - UIInput and validator
« Reply #10 on: November 03, 2013, 10:52:26 AM »
Ah alright! Sorry! But when I delete the whole NGUI-Folder won't that mess up my GUI-Elements, the Atlas and so on since the scripts are all deleted?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Error with 3.0.3g - UIInput and validator
« Reply #11 on: November 03, 2013, 10:52:58 AM »
No. Please follow the instructions.

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Error with 3.0.3g - UIInput and validator
« Reply #12 on: November 03, 2013, 10:54:23 AM »
Alright, thank you for the support!