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

Unity 2022.2以降のScriptedImporterEditor.ResetValues()のObsolete警告が出るのに対応 #2090

Conversation

saturday06
Copy link
Contributor

Unity 2022.2以降のバージョンでScriptedImporterEditor.ResetValues()がObsoleteになり、代わりにDiscardChanges()の利用が推奨されるようになりました。 UniGLTF.RemapScriptedImporterEditorBaseがResetValues()を利用しており、それにより、次のような警告を発生させていました。

Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/RemapScriptedImporterEditorBase.cs(50,33): warning CS0672: Member 'RemapScriptedImporterEditorBase.ResetValues()' overrides obsolete member 'AssetImporterEditor.ResetValues()'. Add the Obsolete attribute to 'RemapScriptedImporterEditorBase.ResetValues()'.
Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/RemapScriptedImporterEditorBase.cs(54,13): warning CS0618: 'AssetImporterEditor.ResetValues()' is obsolete: 'UnityUpgradeable () -> DiscardChanges'

オーバーライドされたResetValuesにもObsoleteを付与することで、警告が抑制されるようになりました。

また、移行先として推奨されているDiscardChanges()の実装も行いました。

Unity 2022.2以降のバージョンでScriptedImporterEditor.ResetValues()がObsoleteになり、代わりにDiscardChanges()の利用が推奨されるようになりました。
UniGLTF.RemapScriptedImporterEditorBaseがResetValues()を利用しており、それにより、次のような警告を発生させていました。

```
Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/RemapScriptedImporterEditorBase.cs(50,33): warning CS0672: Member 'RemapScriptedImporterEditorBase.ResetValues()' overrides obsolete member 'AssetImporterEditor.ResetValues()'. Add the Obsolete attribute to 'RemapScriptedImporterEditorBase.ResetValues()'.
Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/RemapScriptedImporterEditorBase.cs(54,13): warning CS0618: 'AssetImporterEditor.ResetValues()' is obsolete: 'UnityUpgradeable () -> DiscardChanges'
```

オーバーライドされたResetValuesにもObsoleteを付与することで、警告が抑制されるようになりました。

また、移行先として推奨されているDiscardChanges()の実装も行いました。
@vrm-github-bot
Copy link
Collaborator

Can one of the admins verify this patch?

/// </summary>
#if UNITY_2022_2_OR_NEWER
[System.Obsolete]
#endif
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unity2021.2からObsoleteになったbase.ResetValues()を呼んでいたことで警告が出ていました。しかし、このメソッドにもObsoleteをつけることで警告が抑制できました。


base.DiscardChanges();
}
#endif
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResetValuesがObsoleteになり、代わりに推奨されているメソッドがDiscardChangesでした。そこにResetValuesのオーバーライドで行われていた機能を追加しました。

Copy link
Contributor

@ousttrue ousttrue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ousttrue ousttrue merged commit a1854f9 into vrm-c:master Jun 22, 2023
@ousttrue ousttrue added this to the v0.113 milestone Jun 22, 2023
@saturday06 saturday06 deleted the RemapScriptedImporterEditorBase-DiscardChanges branch May 13, 2024 21:21
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.

None yet

3 participants