public static void CreateViewAsset(SerializedProperty property, AbstractView view) { string assetPath = AssetDatabase.GetAssetPath(view); SerializedProperty propertyViewTypeID = property.FindPropertyRelative("viewTypeID"); SerializedProperty propertyResourcePath = property.FindPropertyRelative("resourcePath"); SerializedProperty propertyAssetID = property.FindPropertyRelative("assetID"); propertyViewTypeID.stringValue = view.GetType().AssemblyQualifiedName; propertyResourcePath.stringValue = UViewEditorUtils.GetResourcePath(assetPath); propertyAssetID.stringValue = AssetDatabase.AssetPathToGUID(assetPath); }
private void CreateAllViews() { foreach (string prefabPath in _scaffoldingConfig.ScaffoldingResourcesPath) { UnityEngine.Object[] views = Resources.LoadAll(ConvertPathToResourcePath(prefabPath)); _viewNames = new List <string>(); _fullViewNames = new List <string>(); _abstractViews = new List <AbstractView>(); foreach (UnityEngine.Object o in views) { if (o is GameObject) { AbstractView v = (o as GameObject).GetComponent <AbstractView>(); if (v != null) { _fullViewNames.Add(v.GetType().FullName); _viewNames.Add(v.GetType().Name); _abstractViews.Add(v); } } } views = null; } }
public void UpdateLoadedViews() { _loadedViews.Clear(); Object[] gameObjects = Resources.FindObjectsOfTypeAll(typeof(AbstractView)); int i = 0, l = gameObjects.Length; for (; i < l; ++i) { AbstractView view = gameObjects[i] as AbstractView; if (!EditorUtility.IsPersistent(view)) { _loadedViews.Add(view.GetType(), view); } } }