Advertisement
Huvaakoodia

Unity EventDatabase script

Aug 21st, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. [System.Serializable]
  4. public class EventData
  5. {
  6.     public string name;
  7.     [TextArea(0, 200)]
  8.     public string text;
  9. }
  10.  
  11. public class EventDatabase : MonoBehaviour
  12. {
  13.     public static EventDatabase I;
  14.  
  15.     private void Awake()
  16.     {
  17.         I = this;
  18.     }
  19.  
  20.     public EventData[] events;
  21.  
  22.     public EventData GetEvent(string name)
  23.     {
  24.         for (int i = 0; i < events.Length; i++)
  25.         {
  26.             if (events[i].name == name) return events[i];
  27.         }
  28.         return null;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement