/** * Returns a view for the given game object. If no view exists one is created. * and added to the info to be persisted to disk. isOpen is only used when * a view is being created, otherwise the given view is returned. */ public ObjectView GetView(GameObject go, bool isOpen) { ObjectView ov = null; if (!viewHash.TryGetValue(go, out ov)) { //We haven't encountered this view. Perhaps we have one persisted to disk? long localID = PrefabInspector.GetLocalID(go); if (viewIDHash.TryGetValue(localID, out ov)) { //its in the view id hash but not in the view hash! // Add it. viewHash[go] = ov; } else { //we haven't encountered this object make a new view model and add // to our collections. ov = new ObjectView(go, isOpen); viewHash[go] = ov; viewIDHash[localID] = ov; views.Add(ov); } } ov.obj = go; return(ov); }
static void Init() { // Get existing open window or if none, make a new one: PrefabInspector window = (PrefabInspector)EditorWindow.GetWindow(typeof(PrefabInspector)); window.titleContent = new GUIContent("Prefabs"); window.Show(); }
public ObjectView(GameObject go, bool io) { localID = PrefabInspector.GetLocalID(go); isOpen = io; }