RizzeProjectile/Assets/Scripts/Extensions/ComponentExtensions.cs

26 lines
512 B
C#
Raw Permalink Normal View History

2025-09-26 00:21:07 +05:00
namespace Projectiles
{
using UnityEngine;
public static partial class ComponentExtensions
{
// PUBLIC METHODS
public static T GetComponentNoAlloc<T>(this Component component) where T : class
{
return GameObjectExtensions<T>.GetComponentNoAlloc(component.gameObject);
}
public static void SetActive(this Component component, bool value)
{
if (component == null)
return;
if (component.gameObject.activeSelf == value)
return;
component.gameObject.SetActive(value);
}
}
}