I’m using Unity4.3.0 and getting the following exception in the UnityPlayer log every time I run the game on the WP8 device. Game doesn’t crash, but using the profiler it seems the memory starts to climb rapidly following the error.
Exception: External component has thrown an exception.
Type: System.Runtime.InteropServices.SEHException
Module: UnityEngineProxy
InnerException:
AdditionalInfo:Invoking UnityEngine.SendMouseEvents:oSendMouseEvents method with argument count: 2
at UnityEngineProxy.InternalCalls.Component_CUSTOM_GetComponent(Object self, Object type)
at UnityEngine.SendMouseEvents.DoSendMouseEvents(Int32 mouseUsed, Int32 skipRTCameras)
at lambda_method(Closure , Object , Object[ ] , Int32 )
at WinRTBridge.MethodTools.InvokeMethod(Object instance, Int32 methodIndex, Object[ ] args)
Has a bug for this been logged? I can not find one in the bug system we getting a similar error.
Exception: External component has thrown an exception.
Type: System.Runtime.InteropServices.SEHException
Module: UnityEngineProxy
InnerException:
AdditionalInfo:
at UnityEngineProxy.InternalCalls.PInvokeCalls.GameObject_CUSTOM_GetComponentByName(Int32 param_0, Int32 param_1)
at UnityEngineProxy.InternalCalls.GameObject_CUSTOM_GetComponentByName(Object self, String type)
at SpriteFactory.GetFromCache(String sprite)
at SpriteFactory.CachedGameObject(Int32 x, Int32 y, String scriptname)
at SpriteFactory.NewSplat(Int32 x, Int32 y)
at Goop.FixedUpdate()
at Goop.UnityFastInvoke_FixedUpdate()
This is invoked in the code below. We are fetching a game object from a cache list. I am evaluating if we have accidentally kept the cached list between levels and the gameObjects we are searching for are actually destroyed. I don’t suspect so though since we don’t see this all the time.
public static GameObject GetFromCache(string sprite){
if (cachedSprites.ContainsKey(sprite)){
List<GameObject> list=cachedSprites[sprite];
if (list.Count>0){
GameObject gameObject=list[list.Count-1];
list.RemoveAt(list.Count-1);
if (sprite.EndsWith("Center")){
sprite=sprite.Substring(0,sprite.Length-6);
}
Sprite s=(Sprite)gameObject.GetComponent(sprite);
s.enabled=true;
s.renderer.enabled=true;
s.instantMove=true;
s.currentSprite=-1;
return gameObject;
}
}
#if UNITY_EDITOR
Debug.Log ("Cache Miss "+sprite);
#endif
return null;
}
we did not receive a bug report nor we were able to reproduce it ourselves. Please submit it if you can.
In the meanwhile, could you try using gameObject.GetComponent() instead of non generic version? It should perform better and since the exception is thrown on that line, it may be able to fix it.