Pro_Unit

EventAction

Mar 5th, 2021
714
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.Events;
  4.  
  5. [Serializable]
  6. public  class EventAction
  7. {
  8.     [HideInInspector] [SerializeField] private string _name;
  9.  
  10.     public void OnValidate()
  11.     {
  12.         if (_animationEvent) _name = _animationEvent.name;
  13.     }
  14.  
  15.     [SerializeField] private AnimationEvent _animationEvent;
  16.     [SerializeField] protected UnityEvent  _event;
  17.     public void Invoke() => _event.Invoke();
  18.    
  19.     public static implicit operator int(EventAction eventAction)
  20.         => eventAction._animationEvent.GetInstanceID();
  21.    
  22.     public override string ToString() => _name;
  23. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×