26 lines
653 B
C#
26 lines
653 B
C#
|
using UnityEngine;
|
|||
|
using System;
|
|||
|
using UnityEngine.Events;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// DynamicUI OnUpdate callback invoker.
|
|||
|
/// Insert this script above a target script in the Unity Inspector to invoke Event/Action before that script;
|
|||
|
/// or Insert below a target script to invoke Event/Action after that script.
|
|||
|
/// (This script will invoke the OnUpdate callbacks in the Update method)
|
|||
|
/// </summary>
|
|||
|
public class DOnUpdate : MonoBehaviour
|
|||
|
{
|
|||
|
public Action m_OnUpdate;
|
|||
|
public UnityEvent m_OnUpdateEvent;
|
|||
|
|
|||
|
public bool m_IsPaused = false;
|
|||
|
|
|||
|
void Update()
|
|||
|
{
|
|||
|
if(m_IsPaused) return;
|
|||
|
|
|||
|
if(m_OnUpdate != null) m_OnUpdate();
|
|||
|
m_OnUpdateEvent.Invoke();
|
|||
|
}
|
|||
|
}
|