Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings #539

Merged
merged 3 commits into from
Mar 1, 2019
Merged

Fix warnings #539

merged 3 commits into from
Mar 1, 2019

Conversation

mtschoen-unity
Copy link
Collaborator

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:

  • 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.

@mtschoen-unity mtschoen-unity merged commit c5bfe3d into development Mar 1, 2019
@mtschoen-unity mtschoen-unity deleted the fix-warnings branch March 1, 2019 02:42
@mtschoen-unity mtschoen-unity added this to the 0.2.1 milestone Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants