Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: sHAYM4N on January 07, 2015, 02:20:44 PM

Title: UICamera.ChangeSelection()': not all code paths return a value
Post by: sHAYM4N 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
Title: Re: UICamera.ChangeSelection()': not all code paths return a value
Post by: sHAYM4N 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?
Title: Re: UICamera.ChangeSelection()': not all code paths return a value
Post by: ArenMook 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.         }
Title: Re: UICamera.ChangeSelection()': not all code paths return a value
Post by: sHAYM4N 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!
Title: Re: UICamera.ChangeSelection()': not all code paths return a value
Post by: ArenMook 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
Title: Re: UICamera.ChangeSelection()': not all code paths return a value
Post by: ArenMook 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)
Title: Re: UICamera.ChangeSelection()': not all code paths return a value
Post by: SquigglyFrog 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..
Title: Re: UICamera.ChangeSelection()': not all code paths return a value
Post by: ArenMook on January 14, 2015, 10:09:59 PM
I'll have this patched in this week's update.