25 lines
547 B
C#
25 lines
547 B
C#
using System;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
namespace Cielonos.MainGame
|
|
{
|
|
public class SubcontrollerBase<T> : SerializedMonoBehaviour where T : MonoBehaviour
|
|
{
|
|
[HideInEditorMode]
|
|
public T owner;
|
|
|
|
public virtual void Initialize()
|
|
{
|
|
owner ??= GetComponent<T>() ?? GetComponentInParent<T>();
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
protected virtual void Reset()
|
|
{
|
|
owner ??= GetComponent<T>() ?? GetComponentInParent<T>();
|
|
}
|
|
#endif
|
|
|
|
}
|
|
} |