public void UpdateContent(GUIContent label) { string message; if (!_object) { message = "No object specified"; } else if (!Valid) { message = "Not in Resources folder or Asset Bundle. Will not be saved."; } else if (Bundles.IsBundlePath(_path)) { var bundlePath = Bundles.SplitBundlePath(_path); message = $"Asset Bundle: {bundlePath.Item1}\nPath:{bundlePath.Item2}"; } else { message = $"Path: {_path}"; } if (string.IsNullOrEmpty(label.tooltip)) { Content.tooltip = message; } else { Content.tooltip = $"{label.tooltip}\n{message}"; } }
public AssetBundleScene(string location) { var bundlePath = Bundles.SplitBundlePath(location); BundleName = bundlePath.Item1; SceneName = bundlePath.Item2; }
public AssetBundleAsset(string path) { var bundlePath = Bundles.SplitBundlePath(path); BundleName = bundlePath.Item1; AssetName = bundlePath.Item2; }
public Data(SerializedProperty property, GUIContent content) { _path = property.stringValue; string path = Bundles.IsBundlePath(_path) ? Bundles.SplitBundlePath(_path).Item2 : _path; _object = AssetDatabase.LoadAssetAtPath <SceneAsset>(path); Content = new GUIContent(content); UpdateContent(content); }
static IScene CreateScene(string location) { if (Bundles.IsBundlePath(location)) { return(new AssetBundleScene(location)); } else { return(new BuiltinScene(location)); } }
static IAsset <T> CreateAsset <T>(string location) where T : Object { if (Bundles.IsBundlePath(location)) { return(new AssetBundleAsset <T>(location)); } else { return(new ResourcesAsset <T>(location)); } }
string GetBundlePath(Object obj) { var assetPath = AssetDatabase.GetAssetPath(obj); var bundleName = AssetImporter.GetAtPath(assetPath).assetBundleName; if (!string.IsNullOrEmpty(bundleName)) { return(Bundles.CreateBundlePath(bundleName, assetPath)); } else { return(null); } }
public Data(SerializedProperty property, GUIContent content) { _path = property.stringValue; if (Bundles.IsBundlePath(_path)) { var bundlePath = Bundles.SplitBundlePath(_path); _object = EditorAssetUtil.LoadBundledAsset <Object>(bundlePath.Item1, bundlePath.Item2); } else { _object = Resources.Load <Object>(_path); } Content = new GUIContent(content); UpdateContent(content); }
void Update(Object obj) { _object = obj; var bundleName = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(_object)).assetBundleName; if (EditorAssetUtil.IsResource(_object)) { _path = EditorAssetUtil.GetResourcePath(_object); } else if (!string.IsNullOrEmpty(bundleName)) { _path = Bundles.CreateBundlePath(bundleName, _object.name); } else { _path = string.Empty; } }
public void UpdateContent(GUIContent label) { string message; if (!_object) { message = "No object specified"; } else if (!IsValid) { message = "Not in Build Settings or Asset Bundle. Will not be saved."; } else if (Bundles.IsBundlePath(_path)) { var bundlePath = Bundles.SplitBundlePath(_path); message = $"Asset Bundle: {bundlePath.Item1}\nPath:{bundlePath.Item2}"; } else { message = string.Format("Path: {0}", _path); } Content.tooltip = string.IsNullOrEmpty(label.tooltip) ? message : string.Format("{0}\n{1}", label.tooltip, message); }