Files
Bachelor-Arbeit-Thomas-Wichert/Assets/Convai/Scripts/Runtime/Extensions/GameObjectExtension.cs
2025-07-21 09:11:14 +02:00

9 lines
251 B
C#

using UnityEngine;
public static class GameObjectExtension
{
public static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component
{
return gameObject.TryGetComponent(out T t) ? t : gameObject.AddComponent<T>();
}
}