public static BPhysicsWorld Get() { if (singleton == null && !_isDisposed) { if (!Application.isPlaying) { return(null); } BPhysicsWorld[] ws = FindObjectsOfType <BPhysicsWorld>(); if (ws.Length == 1) { singleton = ws[0]; } else if (ws.Length == 0) { Debug.LogError("Need to add a dynamics world to the scene"); } else { Debug.LogError("Found more than one dynamics world."); singleton = ws[0]; for (int i = 1; i < ws.Length; i++) { GameObject.Destroy(ws[i].gameObject); } } singleton._InitializePhysicsWorld(); } //if (singleton.m_world == null && !singleton.isDisposed) singleton._InitializePhysicsWorld(); return(singleton); }