jacobdufault / fullinspector

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

Delegate serialization causing prefab checkout #200

Open ClementCasaRara opened 7 years ago

ClementCasaRara commented 7 years ago

Hi, First of all, great asset! I have it both at home and now at work and it's a life-saver. :)

We recently found an issue with FullInspector v2.6.3 in Unity 5.5.0f3 where some of our prefabs would constantly get checkout even though they had no modifications. Our version control system is set to lock checked out prefabs so it caused quite a few headaches as people couldn't work because their prefabs were locked by someone that didn't touch it. Here are the repro steps:

  1. Set the project serialization to FullText. (Not sure if 100% necessary but it helps with the diffs)
  2. Create a BaseBehavior script with only a public delegate inside. public class ProblematicScript : FullInspector.BaseBehavior { public delegate void DummyDelegate(); public DummyDelegate ImTheIssueHere; }
  3. Create a prefab and add the problematic script to it.
  4. Commit the prefab so you will be able to see it be checked out later. At this point all seems good.
  5. Cause an assembly reload (adding a space to script somewhere and save).
  6. Select the prefab in the project view.
  7. Save the project.
  8. Notice that the prefab is checked out with no changes in the source control system.

I tracked the behavior down to SaveState in fiISerializedObjectUtility.cs at if (AreListsDifferent(obj.SerializedStateValues, serializedValues)) { The lists are indeed different as one has a null and the other has an empty string. It might be related to the call to RestoreState when the item is selected at step 6.

Let me know if you need more infos.

Tagette commented 7 years ago

I'd like to point out that we also have this issue where prefabs shows as a change in version control but have no content changed. However we don't enforce asset locking so it's not as big of an issue for us. We just reset the changes and move on.