AssetReleaserHelper.cs 961 B

1234567891011121314151617181920212223242526272829
  1. using UniFramework.Pooling;
  2. using UnityEngine;
  3. using YooAsset;
  4. namespace GFGGame
  5. {
  6. public static class AssetReleaserHelper
  7. {
  8. public static void AddReleaserToSpawnObj(GameObject gameObject, string resPath, SpawnHandle handle)
  9. {
  10. var assetReleaser = gameObject.GetComponent<AssetReleaser>();
  11. if (assetReleaser == null)
  12. {
  13. assetReleaser = gameObject.AddComponent<AssetReleaser>();
  14. }
  15. assetReleaser.SetSpawn(resPath, handle);
  16. }
  17. public static void AddReleaserToInstantiateObj(GameObject gameObject, string resPath, AssetOperationHandle handle)
  18. {
  19. AssetReleaser assetReleaser = gameObject.GetComponent<AssetReleaser>();
  20. if (assetReleaser == null)
  21. {
  22. assetReleaser = gameObject.AddComponent<AssetReleaser>();
  23. }
  24. assetReleaser.SetRes(resPath, handle);
  25. }
  26. }
  27. }