private GameObject GetPrefabObject() { GameObject gameObject = null; GameObject sourceObject = _sourceObject; #if UNITY_EDITOR if (_sourceObject == null) { //In the editor find asset from the editor prefab field sourceObject = _prefab._editorAsset; } #endif GameObject prefabObject = PrefabRoot.GetPrefabRoot(sourceObject); if (prefabObject != null && !string.IsNullOrEmpty(_objectName)) { if (prefabObject.name == _objectName || prefabObject.name == _objectName + "(Clone)") { gameObject = prefabObject; } else { Transform child = prefabObject.transform.Find(_objectName); if (child != null) { gameObject = child.gameObject; } } } return(gameObject); }