Exemplo n.º 1
0
		public static bool OpenPrefab(GameObject prefab, PrefabSandboxSetupCompleteCallback callback) {
			string assetPath = AssetDatabase.GetAssetPath(prefab);
			string guid = AssetDatabase.AssetPathToGUID(assetPath);

			bool alreadyEditing = (_data != null && _data.PrefabGuid == guid);
			_setupCompletionCallback = callback;

			if (prefab != null && assetPath != null && PathUtil.IsPrefab(assetPath) && !alreadyEditing) {
				_data = new PrefabSandboxData();
				_data.PrefabGuid = guid;
				_data.PrefabPath = assetPath;
				_data.PrefabAsset = prefab;

				PrefabSandbox.SetupSandbox();
				return true;
			} else {
				if (_setupCompletionCallback != null) {
					_setupCompletionCallback(success: false);
				}
				return false;
			}
		}
Exemplo n.º 2
0
		// PRAGMA MARK - Public Interface
		public static bool OpenPrefab(string guid, PrefabSandboxSetupCompleteCallback callback) {
			string assetPath = AssetDatabase.GUIDToAssetPath(guid);
			GameObject prefab = AssetDatabase.LoadAssetAtPath(assetPath, typeof(GameObject)) as GameObject;

			return PrefabSandbox.OpenPrefab(prefab, callback);
		}