15 lines
331 B
C#
15 lines
331 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace BITKit
|
|
{
|
|
public static class GameObjectExtensions
|
|
{
|
|
public static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component
|
|
{
|
|
return gameObject.TryGetComponent<T>(out var t) ? t : gameObject.AddComponent<T>();
|
|
}
|
|
}
|
|
}
|