12-06-2017, 12:53 PM
(12-02-2017, 05:53 AM)arkon3 Wrote: Hi
I'm getting an exception when the scene start in Xcode. The scene runs fine in the editor and the 2 objects following a spline all
work fine. but as soon as I try and run on IOS device it crashes with this error:
NullReferenceException: A null value was found where an object instance was required.
at FluffyUnderware.DevTools.UnityEventEx`1[T0].HasListeners () [0x00000] in <filename unknown>:0
at FluffyUnderware.Curvy.Controllers.SplineController.BindEvents () [0x00000] in <filename unknown>:0
(Filename: currently not available on il2cpp Line: -1)
NullReferenceException: A null value was found where an object instance was required.
at FluffyUnderware.DevTools.UnityEventEx`1[T0].HasListeners () [0x00000] in <filename unknown>:0
at FluffyUnderware.Curvy.Controllers.SplineController.BindEvents () [0x00000] in <filename unknown>:0
UnityEngine.UnhandledExceptionHandlerrintException(String, Exception)
UnityEngine.UnhandledExceptionHandler:HandleUnhandledException(Object, UnhandledExceptionEventArgs)
(Filename: currently not available on il2cpp Line: -1)
The crash is in your HasListeners function, when I comment it out the spline follower it all works fine.
public bool HasListeners()
{
#if false
if (mCallsCount == null)
{
var fi = typeof(UnityEventBase).FieldByName("m_Calls", false, true);
if (fi != null)
{
mCallerList = fi.GetValue(this);
if (mCallerList != null)
mCallsCount = mCallerList.GetType().PropertyByName("Count").GetGetMethod();
}
}
if (mCount == -1)
{
if (mCallerList != null && mCallsCount != null)
mCount = (int)mCallsCount.Invoke(mCallerList, null); //.GetValue(mCallerList, null);
mCount += GetPersistentEventCount();
}
return (mCount > 0);
#endif
return (mCount > 0);
}
Any ideas?
We ran into this issue as well. We upgraded to 2017.2 and this started to happen exclusively on iOS.
Having investigated the problem, we realized that Unity 2017.2 introduced a couple of breaking changes: namely, that the Unity DLLs are no longer packaged in the same assembly. Curvy ships with a link.xml to prevent iOS from stripping certain assemblies it's only using for Reflection - including
Code:
<linker>
<assembly fullname="UnityEngine">
<type fullname="UnityEngine.Events.*" preserve="all" />
</assembly>
<assembly fullname="Assembly-CSharp">
<type fullname="FluffyUnderware.*" preserve="all" />
</assembly>
</linker>
However, in 2017.2 Events is now under UnityEngine.CoreModule, so we updated the link.xml to be:
<linker>
<assembly fullname="UnityEngine">
<type fullname="UnityEngine.Events.*" preserve="all" />
</assembly>
<assembly fullname="UnityEngine.CoreModule">
<type fullname="UnityEngine.Events.*" preserve="all" />
</assembly>
<assembly fullname="Assembly-CSharp">
<type fullname="FluffyUnderware.*" preserve="all" />
</assembly>
</linker>
And it seemed to work. Hope that helps!