AssetReleaser.cs 660 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections;
  2. using UnityEngine;
  3. namespace GFGGame
  4. {
  5. public class AssetReleaser : MonoBehaviour
  6. {
  7. private string _resPath;
  8. public string resPath
  9. {
  10. get
  11. {
  12. return _resPath;
  13. }
  14. set
  15. {
  16. if (_resPath == value) return;
  17. this.OnDestroy();
  18. _resPath = value;
  19. }
  20. }
  21. private void OnDestroy()
  22. {
  23. if (!string.IsNullOrEmpty(resPath))
  24. {
  25. GFGAsset.Release(resPath);
  26. }
  27. // resPath = string.Empty;
  28. }
  29. }
  30. }