private static T LoadAssetFromAssetDatabase <T>(ParcelObject parcelObject) where T : Object { #if UNITY_EDITOR return(UnityEditor.AssetDatabase.LoadAssetAtPath <T>(parcelObject.assetPath)); #else return(null); #endif }
public static GameObject Instantiate(ParcelObject parcelObject) { if (!Application.isPlaying) { Debug.LogError("Error! Parcel is not used to Instantiate objects at Edit time."); return(null); } else { if (Application.isEditor) { if (!ParcelSettings.instance.useAssetBundleInPlayMode) { LoadAssetFromAssetDatabase <GameObject>(parcelObject); } } return(LoadAssetFromBundle <GameObject>(parcelObject)); } }
private static T LoadAssetFromBundle <T>(ParcelObject parcelObject) where T : Object { return(null); }
/// <summary> /// Instantiate a new GameObject from Parcel using asset bundles at runtime and AssetDatabase at edit time. /// </summary> /// <param name="parcelObject">The parcel object that you want to Instantiate.</param> /// <returns>The instantiated prefab.</returns> public static GameObject Instantiate(this MonoBehaviour monobehaviour, ParcelObject parcelObject) { return(Instantiate(monobehaviour, parcelObject)); }
/// <summary> /// Instantiate a new GameObject from Parcel using asset bundles at runtime and AssetDatabase at edit time. /// </summary> /// <param name="parcelObject">The parcel object that you want to Instantiate.</param> /// <returns>The instantiated prefab.</returns> public static GameObject Instantiate(this GameObject gameobject, ParcelObject parcelObject) { return(Instantiate(gameobject, parcelObject)); }
/// <summary> /// Instantiate a new GameObject from Parcel using asset bundles at runtime and AssetDatabase at edit time. /// </summary> /// <param name="parcelObject">The parcel object that you want to Instantiate.</param> /// <returns>The instantiated prefab.</returns> public static GameObject Instantiate(this Transform transform, ParcelObject parcelObject) { return(Instantiate(transform, parcelObject)); }