private Scene GetSceneFromObject(Object obj) { GameObject obj2 = obj as GameObject; if (obj2 != null) { return obj2.scene; } Component component = obj as Component; if (component != null) { return component.gameObject.scene; } return new Scene(); }