Gets that is represented by the given serialized typename. Used to restore workspace layout. The typename. The window or null if failed.
(string typename)
| 732 | /// <param name="typename">The typename.</param> |
| 733 | /// <returns>The window or null if failed.</returns> |
| 734 | private EditorWindow GetWindow(string typename) |
| 735 | { |
| 736 | // Try use already opened window |
| 737 | for (int i = 0; i < Windows.Count; i++) |
| 738 | { |
| 739 | if (string.Equals(Windows[i].SerializationTypename, typename, StringComparison.OrdinalIgnoreCase)) |
| 740 | return Windows[i]; |
| 741 | } |
| 742 | |
| 743 | // Check if it's an asset ID |
| 744 | if (Guid.TryParse(typename, out Guid id)) |
| 745 | { |
| 746 | var el = Editor.ContentDatabase.Find(id); |
| 747 | if (el != null) |
| 748 | { |
| 749 | // Open asset |
| 750 | return Editor.ContentEditing.Open(el, true); |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | return null; |
| 755 | } |
| 756 | |
| 757 | /// <inheritdoc /> |
| 758 | public override void OnInit() |