Exemplo n.º 1
0
    public static void init()
    {
        if( !instance )
        {
            // check if there is a GoKitLite instance already available in the scene graph before creating one
            instance = FindObjectOfType( typeof( GoKitLite ) ) as GoKitLite;

            if( !instance )
            {
                var obj = new GameObject( "GoKitLite" );
                instance = obj.AddComponent<GoKitLite>();
                DontDestroyOnLoad( obj );
            }
        }
    }
Exemplo n.º 2
0
 private void OnApplicationQuit()
 {
     instance = null;
     Destroy( gameObject );
 }