Fix warnings due to 2018.3 upgrade and default runtime becoming .NET 4.x
Testing status
Tests pass locally. I no longer see EditorXR-related warnings when recompiling in-editor or making player builds. Did a basic smoke test in editor, play mode, and player build.
Technical risk
Very low--mostly pre-processor defines and prefab API updates
Comments to reviewers
That first commit is pretty hefty, so let me break down the changes:
The new prefab workflow requires us to change PrefabUtility.GetPrefabType to PrefabUtility.GetPrefabAssetType, PrefabUtility.CreatePrefab to PrefabUtility.SavePrefabAsset, PrefabUtility.FindPrefabRoot to PrefabUtility.GetOutermostPrefabInstanceRoot, and PrefabUtility.GetPrefabType to PrefabUtility.GetPrefabInstanceStatus
The process in AssetGridItem where we reconnect the preview object to its prefab is no longer viable. Instead, we must re-instantiate the preview with PrefabUtility.InstantiatePrefab. It is not possible to clone a non-prefab object whose children are prefabs and maintain prefab links.
There were many places where private SerializeFields have no setters. This results in a CS0649 warning, which was suppressed in the legacy runtime. For now, I have used #pragma warning disable to suppress the warning in the new 4.x runtime. I could also have fixed this by adding public setters, but they would have been unused, and in many cases would have added a lot of noise to our classes.
The fixes for player builds came down to more aggressively adding #if UNITY_EDITOR, and working around code that should be editor-only.
As I went along, I addressed spelling mistakes, unused fields, and field order issues that I came across.
In doing a final audit of these warning directives, I found a few places where we had mismatched disable/restore directives, and fixed them.
Purpose of this PR
Fix warnings due to 2018.3 upgrade and default runtime becoming .NET 4.x
Testing status
Tests pass locally. I no longer see EditorXR-related warnings when recompiling in-editor or making player builds. Did a basic smoke test in editor, play mode, and player build.
Technical risk
Very low--mostly pre-processor defines and prefab API updates
Comments to reviewers
That first commit is pretty hefty, so let me break down the changes:
PrefabUtility.GetPrefabType
toPrefabUtility.GetPrefabAssetType
,PrefabUtility.CreatePrefab
toPrefabUtility.SavePrefabAsset
,PrefabUtility.FindPrefabRoot
toPrefabUtility.GetOutermostPrefabInstanceRoot
, andPrefabUtility.GetPrefabType
toPrefabUtility.GetPrefabInstanceStatus
PrefabUtility.InstantiatePrefab
. It is not possible to clone a non-prefab object whose children are prefabs and maintain prefab links.SerializeField
s have no setters. This results in a CS0649 warning, which was suppressed in the legacy runtime. For now, I have used #pragma warning disable to suppress the warning in the new 4.x runtime. I could also have fixed this by adding public setters, but they would have been unused, and in many cases would have added a lot of noise to our classes.