1
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user