This commit is contained in:
CortexCore
2023-11-15 23:54:54 +08:00
parent ee3ecec6cb
commit 3c837a4a33
356 changed files with 73756 additions and 26493 deletions

View File

@@ -10,5 +10,12 @@ namespace BITKit
{
return gameObject.TryGetComponent<T>(out var t) ? t : gameObject.AddComponent<T>();
}
public static T RemoveComponent<T>(this GameObject gameObject) where T : Component
{
var t = gameObject.GetComponent<T>();
if (t is null) return null;
Object.Destroy(t);
return t;
}
}
}