AssetUnloader.cs 229 B

12345678910111213141516
  1. using System;
  2. using UnityEngine;
  3. namespace TriLib
  4. {
  5. public class AssetUnloader : MonoBehaviour
  6. {
  7. protected virtual void OnDestroy()
  8. {
  9. if (Application.isPlaying)
  10. {
  11. Resources.UnloadUnusedAssets();
  12. }
  13. }
  14. }
  15. }