jacobdufault / fullinspector

Full Inspector supercharges Unity's inspector
MIT License
111 stars 27 forks source link

Animation Curves not serialized (?) in Unity 2017 #210

Open BillSansky opened 7 years ago

BillSansky commented 7 years ago

Hi!

I found a critical issue with the Fullinspector serialization on the unity 2017 version. It seems that Animation curves in a BaseBehavior aren't being serialized, and despite all my effort (including reinstalling FullInspector, and reimporting everything after deleting library and temp folders) I cannot make Animation Curves work with full inspector at all.

What happens is that if a curve was set prior to a class being derived from BaseBehavior, it is still visible but not editable, but if it is a newly created object the field will remain blank no matter how much I try to change it.

I have them everywhere so that's quite a blocker :/

Any idea of a work around?

SugoiDev commented 7 years ago

I just replied to you on the forums. I'll paste the reply here for future visitors.


Are you using the latest version from Github or from the asset store? The asset store version is quite outdated.

See: https://github.com/jacobdufault/fullinspector/ I'm using FI with Unity 2017 and haven't noticed anything unusual so far, but I don't rely on it for serialization. Just for custom inspectors.

Before you fall into the trap of relying too much on special serialization, I suggest you read this other issue: https://github.com/vexe/VFW/issues/88#issuecomment-213857086 Gist: don't rely on special serialization. Keep your serialized data as simple as possible.

Also, if you're starting a new project, I would recommend reading this issue on the current development status: https://github.com/jacobdufault/fullinspector/issues/203 Gist: I don't recommend adding FI to new projects at this time.

Whyser commented 7 years ago

Sorry to hijack this issue, but @SugoiDev , do you happen to know if FI works for iOS, as is, in Unity 2017? Doing nothing different I get Null refs and a lot of other stuff when starting my app on iOS built with Unity 2017. In the editor there is no problem (can't remember when/where I got the FI version I have). Thanks!

SugoiDev commented 7 years ago

@Whyser

Do you have a way to get the stacktraces? Was everything working properly with versions before 2017? Did you try with the latest version from this repository? I'm still using FI with Unity 2017, but for not for a iOS release.

Maybe open a new issue and paste some stacktraces so we can take a look. Depending on what is going on, it might be possible for us to patch it up.

Whyser commented 7 years ago

A quick look at the stack trace led me to "System.ExecutionEngineException: Attempting to call method 'System.Reflection.MonoProperty::GetterAdapterFrame' for which no ahead of time (AOT) code was generated.". And I found this related: "https://forum.unity3d.com/threads/unity-5-0-3f2-il2cpp-problem-attempting-to-call-method-system-reflection-monoproperty-getteradapt.332335/" which indicates that there's an issue with Unity 2017.1 currently. In other words, this issue might "solve itself" once Unity releases a patch.

Thanks for the quick response!

SugoiDev commented 7 years ago

Are using net 2.0 subset? Did you try with the experimental 4.6 or with the full 2.0? I migrated to 2017 mostly because of net 4.6, since I've been using C#6 with Unity for a while and I felt better having it official. Because of this, I never really tested FI with net 2.0 on 2017.

There's also this issue on the Unity issue tracker related to that as well. It is marked as fixed in 5.2.4

Whyser commented 7 years ago

Im using Subset 2.0 with Experimental 4.6. Didn't try without Subset. Will try tomorrow!

SugoiDev commented 7 years ago

Awesome!

If it works without subset, it might really be a regression related to the issues you found. In that case, if you can collect detailed stacktraces and submit to Unity, it might help to get it fixed (also post it in that forum thread, they are responsive in the forums).

Let us know if it works.

Whyser commented 7 years ago

Sorry if I confused you yesterday, I was a bit tired! I meant to say: FI does not work properly when using Experimental 4.6 (Confirmed), and I have yet to test using the "old" Subset 2.0. Today I tested using Subset 2.0 and it works as before (Confirmed), meaning the issue lies in Experimental 4.6, which is probably fixed in Unitys next patch release. Or one can make the changes suggested by Dustin-Horne in the forum:

Take a look at the source and see if FullInspector is calling .GetValue on a PropertyInfo instance anywhere. I tracked down an edge case in Json .Net that was still doing it. If you replace that with .GetGetMethod().Invoke it should fix the problem.

SugoiDev commented 7 years ago

Ah, I see! I took at look at the p3 patch release and there's nothing in the changelog about this yet.

So I tried quickly changing the GetValue calls that were being made on PropertyInfo instances and it broke the tkEditors (at least, didn't test much). This happened with full 4.6 profile and Windows build target.

These are the files that have GetValue on a PropertyInfo instance:

fiSerializedPropertyUtility fiRuntimeReflectionUtility InspectedProperty tkControl fsKeyValuePairConverter fsMetaProperty

SugoiDev commented 7 years ago

@Whyser When you're testing, try changing the GetValue calls on PropertyInfo instances that use two parameters to ones using the full 5 parameters, like anton suggested in that thread