microsoft / MRDL_Unity_Surfaces

Touchable surfaces for Hololens and Immersive headset
MIT License
87 stars 26 forks source link

API changes in Unity 2021.2a19 #6

Open mjmvisser opened 3 years ago

mjmvisser commented 3 years ago

Unity 2021.2a19 has some API changes that will affect this code:

https://github.com/microsoft/MRDL_Unity_Surfaces/blob/dc3f88b36c7df76f9460280199f551d525028b52/Assets/MixedRealityToolkit/Utilities/Editor/IconEditor.cs#L23

Starting with this version of Unity, MonoImporter.CopyMonoScriptIconToImporters can be replaced with the following:

// given monoScript and icon
var importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(monoScript));
importer.SetIcon(icon);
importer.SaveAndReimport();
mjmvisser commented 2 years ago

Please note that the internal method MonoImporter.CopyMonoScriptIconToImporters will be removed in Unity 2022.2.