Hero.get C# (CSharp) Method

get() public static method

public static get ( ) : Hero
return Hero
    public static Hero get() {
        if (_instance == null)
        {
            GameObject go = GameObject.Find(gameObjectName);
            if(null != go)
            {
                _instance = go.GetComponent<Hero>();
                if(null != _instance) {
                    _instance.initializeIfNecessary();
                }
            }
            else
            {
                Logger.Log("Hero::get couldn't find game object", Logger.Level.ERROR);
            }
        }
        return _instance;
    }
    void Awake()

Usage Example

Ejemplo n.º 1
0
 private void OnPress(bool isPressed)
 {
     if (isPressed)
     {
         Hero.get().kill();
     }
 }
All Usage Examples Of Hero::get