You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

20 line
292 B

  1. using System;
  2. using UnityEngine;
  3. public class MagicalReference<T> where T : UnityEngine.Object
  4. {
  5. public T reference
  6. {
  7. get
  8. {
  9. if (this._ref == null)
  10. {
  11. this._ref = UnityEngine.Object.FindObjectOfType<T>();
  12. }
  13. return this._ref;
  14. }
  15. }
  16. private T _ref;
  17. }