Author Topic: UICamera.ChangeSelection()': not all code paths return a value  (Read 5709 times)

sHAYM4N

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
UICamera.ChangeSelection()': not all code paths return a value
« on: January 07, 2015, 02:20:44 PM »
Sorry if I'm missing something completely obvious here.  Just trying to run a simple test project on my device NGUI 3.78/Unity 4.6.1f1 - when switching to Windows Phone 8 Build I get an error from UICamera.cs

Assets/NGUI/Scripts/UI/UICamera.cs(554,40): error CS0161: `UICamera.ChangeSelection()': not all code paths return a value

Obviously nothing wrong with the script as it's fine under other build settings.  Switching back to webplayer it's fine?

Thanks in advance! :o
« Last Edit: January 08, 2015, 04:56:07 AM by sHAYM4N »

sHAYM4N

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: UICamera.ChangeSelection()': not all code paths return a value
« Reply #1 on: January 08, 2015, 08:13:06 AM »
Have just tried reinstalling Unity and the problems still persists.  If I remove NGUI I can switch to Windows Phone 8 without a problem.  I have also tried setting up a blank project (with only NGUI imported) and the same error?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICamera.ChangeSelection()': not all code paths return a value
« Reply #2 on: January 08, 2015, 09:02:21 AM »
Get rid of the #if statement at the beginning.
  1.         System.Collections.IEnumerator ChangeSelection ()
  2.         {
  3. //#if !UNITY_WINRT && !UNITY_WP8 && !UNITY_WP_8_1
  4.         yield return new WaitForEndOfFrame();
  5. //#endif
  6.                 if (onSelect != null) onSelect(mCurrentSelection, false);
  7.                 Notify(mCurrentSelection, "OnSelect", false);
  8.                 mCurrentSelection = mNextSelection;
  9.                 mNextSelection = null;
  10.  
  11.                 if (mCurrentSelection != null)
  12.                 {
  13.                         current = this;
  14.                         currentCamera = mCam;
  15.                         UICamera.currentScheme = mNextScheme;
  16.                         inputHasFocus = (mCurrentSelection.GetComponent<UIInput>() != null);
  17.                         if (onSelect != null) onSelect(mCurrentSelection, true);
  18.                         Notify(mCurrentSelection, "OnSelect", true);
  19.                         current = null;
  20.                 }
  21.                 else inputHasFocus = false;
  22.         }
« Last Edit: January 08, 2015, 09:09:41 AM by ArenMook »

sHAYM4N

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: UICamera.ChangeSelection()': not all code paths return a value
« Reply #3 on: January 08, 2015, 09:19:23 AM »
Thanks Aren! :)

Assets/NGUI/Scripts/UI/UIInput.cs(1126,29): error CS0103: The name `mKeyboard' does not exist in the current context

Threw the above error on UIInput.cs regarding the keyboard, have commented the below lines out from OnPress and now all seems to be ok.  Guess I'll deal with keyboard errors if & when  :o

  1. /*#if UNITY_WP8 || UNITY_WP_8_1
  2.                         if (mKeyboard != null) mKeyboard.active = true;
  3. #endif */

Thanks again!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICamera.ChangeSelection()': not all code paths return a value
« Reply #4 on: January 08, 2015, 09:43:00 AM »
Eh... mKeyboard is used if the MOBILE flag is set, which is set for both UNITY_WP8 and UNITY_WP_8_1:
  1. #if !UNITY_EDITOR && (UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_WP_8_1 || UNITY_BLACKBERRY)
  2. #define MOBILE
  3. #endif

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICamera.ChangeSelection()': not all code paths return a value
« Reply #5 on: January 08, 2015, 09:45:04 AM »
Oh yeah, that statement should include the !UNITY_EDITOR too:
  1. #if !UNITY_EDITOR && (UNITY_WP8 || UNITY_WP_8_1)

SquigglyFrog

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: UICamera.ChangeSelection()': not all code paths return a value
« Reply #6 on: January 14, 2015, 05:42:32 PM »
Thanks for this, as soon as I updated NGUI this hit me.. still does on every new project..

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICamera.ChangeSelection()': not all code paths return a value
« Reply #7 on: January 14, 2015, 10:09:59 PM »
I'll have this patched in this week's update.