mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-24 00:58:59 -05:00
28 lines
736 B
C#
28 lines
736 B
C#
|
using UnityEngine;
|
||
|
|
||
|
namespace UnityAtoms
|
||
|
{
|
||
|
|
||
|
public class OnAwakeHook : VoidHook
|
||
|
{
|
||
|
[SerializeField]
|
||
|
private VoidListener listener;
|
||
|
[SerializeField]
|
||
|
private VoidGameObjectListener listenerWithGO;
|
||
|
|
||
|
private void Awake()
|
||
|
{
|
||
|
// This is needed because it's not certain that OnEnable on all scripts are called before Awake on all scripts
|
||
|
if (Event != null && listener != null)
|
||
|
{
|
||
|
Event.RegisterListener(listener);
|
||
|
}
|
||
|
if (EventWithGORef != null && listenerWithGO != null)
|
||
|
{
|
||
|
EventWithGORef.RegisterListener(listenerWithGO);
|
||
|
}
|
||
|
|
||
|
OnHook(new Void());
|
||
|
}
|
||
|
}
|
||
|
}
|