39 lines
No EOL
2.3 KiB
C#
39 lines
No EOL
2.3 KiB
C#
using UnityEngine;
|
|
|
|
namespace Pooling {
|
|
public static class PoolerExtensions {
|
|
public static void CreatePool<T>(this T prefab) where T : Component =>
|
|
Pooler.CreatePool(prefab, 0);
|
|
public static void CreatePool<T>(this T prefab, int initialPoolSize) where T : Component =>
|
|
Pooler.CreatePool(prefab, initialPoolSize);
|
|
public static void CreatePool(this GameObject prefab) =>
|
|
Pooler.CreatePool(prefab, 0);
|
|
public static void CreatePool(this GameObject prefab, int initialPoolSize) =>
|
|
Pooler.CreatePool(prefab, initialPoolSize);
|
|
|
|
public static T Spawn<T>(this T prefab, Transform parent, Vector3 position, Quaternion rotation) where T : Component =>
|
|
Pooler.Spawn(prefab, parent, position, rotation);
|
|
public static T Spawn<T>(this T prefab, Vector3 position, Quaternion rotation) where T : Component =>
|
|
Pooler.Spawn(prefab, null, position, rotation);
|
|
public static T Spawn<T>(this T prefab, Transform parent, Vector3 position) where T : Component =>
|
|
Pooler.Spawn(prefab, parent, position, Quaternion.identity);
|
|
public static T Spawn<T>(this T prefab, Vector3 position) where T : Component =>
|
|
Pooler.Spawn(prefab, null, position, Quaternion.identity);
|
|
public static T Spawn<T>(this T prefab, Transform parent) where T : Component =>
|
|
Pooler.Spawn(prefab, parent, Vector3.zero, Quaternion.identity);
|
|
public static T Spawn<T>(this T prefab) where T : Component =>
|
|
Pooler.Spawn(prefab, null, Vector3.zero, Quaternion.identity);
|
|
public static GameObject Spawn(this GameObject prefab, Transform parent, Vector3 position, Quaternion rotation) =>
|
|
Pooler.Spawn(prefab, parent, position, rotation);
|
|
public static GameObject Spawn(this GameObject prefab, Vector3 position, Quaternion rotation) =>
|
|
Pooler.Spawn(prefab, null, position, rotation);
|
|
public static GameObject Spawn(this GameObject prefab, Transform parent, Vector3 position) =>
|
|
Pooler.Spawn(prefab, parent, position, Quaternion.identity);
|
|
public static GameObject Spawn(this GameObject prefab, Vector3 position) =>
|
|
Pooler.Spawn(prefab, null, position, Quaternion.identity);
|
|
public static GameObject Spawn(this GameObject prefab, Transform parent) =>
|
|
Pooler.Spawn(prefab, parent, Vector3.zero, Quaternion.identity);
|
|
public static GameObject Spawn(this GameObject prefab) =>
|
|
Pooler.Spawn(prefab, null, Vector3.zero, Quaternion.identity);
|
|
}
|
|
} |