Author Topic: WP8 UIButtonScale cause exception on OnHover  (Read 4374 times)

Lotti

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 47
    • View Profile
WP8 UIButtonScale cause exception on OnHover
« on: July 09, 2014, 11:42:21 AM »
latest unity (4.5.1) with latest ngui (3.6.7)

  1. System.Runtime.InteropServices.SEHException: External component has trown an exception.
  2. at UnityEngine.Internal.$Call.Invoke39(Int32 arg0, IntPtr method)
  3. at UnityEngine.Component.InternalGetGameObject()
  4. at UIButtonScale.OnHover(Boolean isOver)
  5.  

I think it is (as usual) a problem unity side. Do you think there is the possibility to fix this one?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: WP8 UIButtonScale cause exception on OnHover
« Reply #1 on: July 09, 2014, 03:39:34 PM »
Do you have stripping turned on?

OnHover function is:
  1.         void OnHover (bool isOver)
  2.         {
  3.                 if (enabled)
  4.                 {
  5.                         if (!mStarted) Start();
  6.                         TweenScale.Begin(tweenTarget.gameObject, duration, isOver ? Vector3.Scale(mScale, hover) : mScale).method = UITweener.Method.EaseInOut;
  7.                 }
  8.         }
Since the error message mentions InternalGetGameObject, I assume it's trying to do the "tweenTarget.gameObject". Is 'tweenTarget' null?

Lotti

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 47
    • View Profile
Re: WP8 UIButtonScale cause exception on OnHover
« Reply #2 on: July 10, 2014, 03:44:44 AM »
No stripping is off, but we are using .net 2.0 subset.
Target may be null or not. Depends on how much i paid attention while developing the gui. However it seems to me that uibuttonscale works fine also with null target.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: WP8 UIButtonScale cause exception on OnHover
« Reply #3 on: July 10, 2014, 08:59:38 PM »
It sets the target itself if it's null, as I recall. But if it's called before it's set, it can still be null. Either set it, or add a null check for that.