diff --git a/ChangeLog.md b/ChangeLog.md index e937264d..0d8c2ac9 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - A target layer can be defined for instantiated GameObjects via `GameObjectInstantiator.Settings.layer` (thanks [Krzysztof Lesiak][Holo-Krzysztof] for #393) - Re-normalize bone weights (always for design-time import and opt-in at runtime via `GLTFAST_SAFE` scripting define) +- `GltfAssetBase.Dispose` for releasing resources ### Changed - Mecanim (non-legacy) is now the default for importing animation clips at design-time (thanks [@hybridherbst][hybridherbst] for #388) - All four bone weights are imported at design-time, regardless of quality setting diff --git a/Runtime/Scripts/GltfAssetBase.cs b/Runtime/Scripts/GltfAssetBase.cs index 38440e03..e7df8d87 100644 --- a/Runtime/Scripts/GltfAssetBase.cs +++ b/Runtime/Scripts/GltfAssetBase.cs @@ -135,12 +135,19 @@ protected virtual void PostInstantiation(IInstantiator instantiator, bool succes currentSceneId = success ? importer.defaultSceneIndex : (int?)null; } - protected virtual void OnDestroy() - { + /// + /// Releases previously allocated resources. + /// + public void Dispose() { if(importer!=null) { importer.Dispose(); importer=null; } } + + protected virtual void OnDestroy() + { + Dispose(); + } } }