Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CurvyEvents problems in AOT environment
#1
Hi,

When running in a AOT environment, the SplineController code throws up all sorts of errors due to CurvyEvents using GetValue (in HasListeners at lines 47 and 55), which doesn't work with --aot-only. This is a problem on consoles and probably on iOS as well.

Any fixes or workarounds to that GetValue call would be appreciated... (It may have something to do with the type being a Generic, too...?)
Reply
#2
Hi,

seems like that's a known issue: https://docs.unity3d.com/Manual/TroubleS...Phone.html (see also here)

According to the docs it works if you switch API Compatibility Level to .NET 2.0 Subset.  On the other side it should be possible to add the relevant namespaces to the link.xml provided with Curvy to prevent it being optimized away by Mono. 

Edit: Searching the forums I found the following:

"the object you're executing those on is a methodinfo. If the thing you're setting is a Field then you're fine... but if it's a property it's going to puke so you'll need to use GetGetMethod and GetSetMethod and then call Invoke on those to set the value to ensure compatibility cross platform."

Seems like there's a way to code it in a more compatible way. Unfortunately I don't have the option to test that out. If I send you some changed code, would you mind testing it?

Best regards,
Jake
Reply
#3
Ok, this could be a quick hack:

First, change mCallsCount type from PropertyInfo to MethodInfo.

Then, change the two lines you mentioned in HasListeners() to:

Code:
mCallsCount = mCallerList.GetType().PropertyByName("Count").GetGetMethod();

and further down:

Code:
mCount = (int)mCallsCount.Invoke(mCallerList, null);

That should do the trick!
Reply
#4
Excellent, that worked, thank you!

I can't run with .Net Subset because of other libraries, sadly :-(
Reply
#5
Oh, although I should point out it's actually
Code:
mCallsCount = mCallerList.GetType().GetProperty("Count").GetGetMethod();

Thank you!
Reply
#6
You should use PropertyByName() - it's a DevTools extension using WinPhone compatible reflection when needed.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Timing problems Lupp_ 4 65 01-15-2021, 05:11 PM
Last Post: _Aka_
  Splines Connections Problems UsernameHed 4 2,816 07-20-2019, 03:12 PM
Last Post: _Aka_
  Problems by upgrading from Curvy 2.2.2 to 2.2.4.1 metroidsnes 2 3,666 05-06-2018, 07:32 PM
Last Post: _Aka_
  Dynamically Generated Spline Problems ricardo@fivebits.gs 1 3,367 04-05-2017, 06:26 PM
Last Post: Jake

Forum Jump: