mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-24 09:08:23 -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());
|
|
}
|
|
}
|
|
} |