Files
ichni_Official/Assets/Plugins/CW/LeanPool/Extras/Scripts/LeanPooledRigidbody2D.cs

23 lines
604 B
C#
Raw Normal View History

2025-06-03 02:42:28 -04:00
using UnityEngine;
namespace Lean.Pool
{
/// <summary>This component will automatically reset a Rigidbody2D when it gets spawned/despawned.</summary>
[RequireComponent(typeof(Rigidbody2D))]
[HelpURL(LeanPool.HelpUrlPrefix + "LeanPooledRigidbody2D")]
[AddComponentMenu(LeanPool.ComponentPathPrefix + "Pooled Rigidbody2D")]
public class LeanPooledRigidbody2D : MonoBehaviour, IPoolable
{
public void OnSpawn()
{
}
public void OnDespawn()
{
var rigidbody2D = GetComponent<Rigidbody2D>();
rigidbody2D.velocity = Vector2.zero;
rigidbody2D.angularVelocity = 0.0f;
}
}
}