├── .gitignore ├── .npmignore ├── .yamato ├── promotion.yml └── upm-ci.yml ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── CONTRIBUTING.md ├── CONTRIBUTING.md.meta ├── Documentation~ ├── Images.meta ├── Images │ ├── assembly_inspector.png │ ├── clear_console_icon.png │ ├── code_snippet_selection.png │ ├── collapsed_object_inspection.png │ ├── dictionary_collapsed.png │ ├── expanded_object_inspection.png │ ├── fully_expanded_object_inspection.png │ ├── gameobject_inspector.png │ ├── hide_assembly_inspector_icon.png │ ├── multi_view_selection.png │ ├── multiline_mode.png │ ├── multiline_mode_icon.png │ ├── namespace_list.png │ ├── namespace_static_object_inspector.png │ ├── namespace_type_list.png │ ├── quickview_icon_blue.png │ ├── run_code_icon.png │ ├── simple_dictionary_fullview_inspector.png │ ├── simple_dictionary_inspector.png │ └── single_line_input_example.png └── com.unity.immediate-window.md ├── Editor.meta ├── Editor ├── AssemblyInfo.cs ├── AssemblyInfo.cs.meta ├── Resources.meta ├── Resources │ ├── Styles.meta │ ├── Styles │ │ ├── Main_Dark.scss │ │ ├── Main_Dark.scss.meta │ │ ├── Main_Dark.uss │ │ ├── Main_Dark.uss.meta │ │ ├── Main_Light.scss │ │ ├── Main_Light.scss.meta │ │ ├── Main_Light.uss │ │ ├── Main_Light.uss.meta │ │ ├── _common.scss │ │ └── _common.scss.meta │ ├── Templates.meta │ └── Templates │ │ ├── Alert.uxml │ │ ├── Alert.uxml.meta │ │ ├── Console.uxml │ │ ├── Console.uxml.meta │ │ ├── ConsoleOutput.uxml │ │ ├── ConsoleOutput.uxml.meta │ │ ├── ConsoleToolbar.uxml │ │ ├── ConsoleToolbar.uxml.meta │ │ ├── Context.uxml │ │ ├── Context.uxml.meta │ │ ├── ImmediateWindow.uxml │ │ ├── ImmediateWindow.uxml.meta │ │ ├── OutputItem.uxml │ │ ├── OutputItem.uxml.meta │ │ ├── UIElementsSchema.meta │ │ └── UIElementsSchema │ │ ├── UIElements.xsd │ │ ├── UIElements.xsd.meta │ │ ├── UnityEditor.Experimental.UIElements.xsd │ │ ├── UnityEditor.Experimental.UIElements.xsd.meta │ │ ├── UnityEditor.ImmediateWindow.UI.xsd │ │ ├── UnityEditor.ImmediateWindow.UI.xsd.meta │ │ ├── UnityEngine.Experimental.UIElements.xsd │ │ └── UnityEngine.Experimental.UIElements.xsd.meta ├── Sources.meta ├── Sources │ ├── Services.meta │ ├── Services │ │ ├── Analytics.meta │ │ ├── Analytics │ │ │ ├── ImmediateWindowAnalytics.cs │ │ │ └── ImmediateWindowAnalytics.cs.meta │ │ ├── Code.meta │ │ ├── Code │ │ │ ├── Evaluator.cs │ │ │ ├── Evaluator.cs.meta │ │ │ ├── Globals.cs │ │ │ ├── Globals.cs.meta │ │ │ ├── Inspector.cs │ │ │ └── Inspector.cs.meta │ │ ├── Common.meta │ │ ├── Common │ │ │ ├── Config.cs │ │ │ ├── Config.cs.meta │ │ │ ├── PropertyInfo.cs │ │ │ ├── PropertyInfo.cs.meta │ │ │ ├── PropertyUtils.cs │ │ │ ├── PropertyUtils.cs.meta │ │ │ ├── Resources.cs │ │ │ ├── Resources.cs.meta │ │ │ ├── UIUtils.cs │ │ │ ├── UIUtils.cs.meta │ │ │ ├── VisualElementExtensions.cs │ │ │ └── VisualElementExtensions.cs.meta │ │ ├── External.meta │ │ ├── External │ │ │ ├── ParsedAssemblyQualifiedName.cs │ │ │ └── ParsedAssemblyQualifiedName.cs.meta │ │ ├── QuickInspector.meta │ │ ├── QuickInspector │ │ │ ├── ATypeView.cs │ │ │ ├── ATypeView.cs.meta │ │ │ ├── ITypeView.cs │ │ │ ├── ITypeView.cs.meta │ │ │ ├── TypeViewFinder.cs │ │ │ ├── TypeViewFinder.cs.meta │ │ │ ├── ViewContext.cs │ │ │ ├── ViewContext.cs.meta │ │ │ ├── ViewMode.cs │ │ │ └── ViewMode.cs.meta │ │ ├── State.meta │ │ └── State │ │ │ ├── Command.cs │ │ │ ├── Command.cs.meta │ │ │ ├── History.cs │ │ │ ├── History.cs.meta │ │ │ ├── State.cs │ │ │ └── State.cs.meta │ ├── UI.meta │ └── UI │ │ ├── Common.meta │ │ ├── Common │ │ ├── Arrow.cs │ │ ├── Arrow.cs.meta │ │ ├── ArrowToggle.cs │ │ ├── ArrowToggle.cs.meta │ │ ├── Container.cs │ │ ├── Container.cs.meta │ │ ├── Expandable.cs │ │ ├── Expandable.cs.meta │ │ ├── ExtendedExpandable.cs │ │ ├── ExtendedExpandable.cs.meta │ │ ├── Span.cs │ │ ├── Span.cs.meta │ │ ├── Text.cs │ │ └── Text.cs.meta │ │ ├── QuickInspector.meta │ │ ├── QuickInspector │ │ ├── QuickInspector.cs │ │ ├── QuickInspector.cs.meta │ │ ├── TestObjects.meta │ │ ├── TestObjects │ │ │ ├── Objects.cs │ │ │ └── Objects.cs.meta │ │ ├── TypeInspector.cs │ │ ├── TypeInspector.cs.meta │ │ ├── TypeViews.meta │ │ └── TypeViews │ │ │ ├── ArrayType.cs │ │ │ ├── ArrayType.cs.meta │ │ │ ├── ComplexObjectType.cs │ │ │ ├── ComplexObjectType.cs.meta │ │ │ ├── DictionaryType.cs │ │ │ ├── DictionaryType.cs.meta │ │ │ ├── Libs.meta │ │ │ ├── Libs │ │ │ ├── CachedView.cs │ │ │ ├── CachedView.cs.meta │ │ │ ├── CollapsedArrayGroup.cs │ │ │ ├── CollapsedArrayGroup.cs.meta │ │ │ ├── CollapsedDictionaryGroup.cs │ │ │ ├── CollapsedDictionaryGroup.cs.meta │ │ │ ├── CollapsedPropertyGroup.cs │ │ │ ├── CollapsedPropertyGroup.cs.meta │ │ │ ├── ExpandableObject.cs │ │ │ ├── ExpandableObject.cs.meta │ │ │ ├── ExpandedArrayGroup.cs │ │ │ ├── ExpandedArrayGroup.cs.meta │ │ │ ├── ExpandedClassType.cs │ │ │ ├── ExpandedClassType.cs.meta │ │ │ ├── ExpandedDictionaryGroup.cs │ │ │ ├── ExpandedDictionaryGroup.cs.meta │ │ │ ├── ExpandedInterfaceGroup.cs │ │ │ ├── ExpandedInterfaceGroup.cs.meta │ │ │ ├── ExpandedMethodGroup.cs │ │ │ ├── ExpandedMethodGroup.cs.meta │ │ │ ├── ExpandedPropertyGroup.cs │ │ │ ├── ExpandedPropertyGroup.cs.meta │ │ │ ├── Interface.cs │ │ │ ├── Interface.cs.meta │ │ │ ├── Method.cs │ │ │ ├── Method.cs.meta │ │ │ ├── PropertyValueGroup.cs │ │ │ ├── PropertyValueGroup.cs.meta │ │ │ ├── ProperyLabel.cs │ │ │ ├── ProperyLabel.cs.meta │ │ │ ├── ProperyTypeLabel.cs │ │ │ ├── ProperyTypeLabel.cs.meta │ │ │ ├── TypeViewMenu.cs │ │ │ ├── TypeViewMenu.cs.meta │ │ │ ├── TypeViewQuickSwitch.cs │ │ │ ├── TypeViewQuickSwitch.cs.meta │ │ │ ├── TypeViewSelection.cs │ │ │ └── TypeViewSelection.cs.meta │ │ │ ├── NullType.cs │ │ │ ├── NullType.cs.meta │ │ │ ├── ObjectType.cs │ │ │ ├── ObjectType.cs.meta │ │ │ ├── StringType.cs │ │ │ ├── StringType.cs.meta │ │ │ ├── ValueType.cs │ │ │ ├── ValueType.cs.meta │ │ │ ├── Views.meta │ │ │ └── Views │ │ │ ├── ClassView.cs │ │ │ ├── ClassView.cs.meta │ │ │ ├── TypeNameView.cs │ │ │ └── TypeNameView.cs.meta │ │ ├── Window.meta │ │ └── Window │ │ ├── AssemblyInspector.cs │ │ ├── AssemblyInspector.cs.meta │ │ ├── Console.meta │ │ ├── Console │ │ ├── Console.cs │ │ ├── Console.cs.meta │ │ ├── ConsoleOutput.cs │ │ ├── ConsoleOutput.cs.meta │ │ ├── ConsoleToolbar.cs │ │ ├── ConsoleToolbar.cs.meta │ │ ├── OutputItem.cs │ │ └── OutputItem.cs.meta │ │ ├── Context.cs │ │ ├── Context.cs.meta │ │ ├── ContextInspector.cs │ │ ├── ContextInspector.cs.meta │ │ ├── ImmediateWindow.cs │ │ ├── ImmediateWindow.cs.meta │ │ ├── NamespaceInspector.cs │ │ └── NamespaceInspector.cs.meta ├── Unity.ImmediateWindow.Editor.asmdef └── Unity.ImmediateWindow.Editor.asmdef.meta ├── LICENSE.md ├── LICENSE.md.meta ├── README.md ├── README.md.meta ├── Tests.meta ├── Tests ├── Unity.ImmediateWindow.Tests.asmdef ├── Unity.ImmediateWindow.Tests.asmdef.meta ├── WindowTests.cs └── WindowTests.cs.meta ├── Third Party Notices.md ├── Third Party Notices.md.meta ├── build.bat ├── build.bat.meta ├── build.sh ├── build.sh.meta ├── package.json └── package.json.meta /.gitignore: -------------------------------------------------------------------------------- 1 | .npmrc 2 | .vscode 3 | .idea 4 | !Documentation~ 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .npmrc 2 | .npmignore 3 | .gitignore 4 | QAReport.md 5 | QAReport.md.meta 6 | .vscode 7 | .idea 8 | .gitlab-ci.yml 9 | -------------------------------------------------------------------------------- /.yamato/promotion.yml: -------------------------------------------------------------------------------- 1 | test_editors: 2 | - version: 2019.1 3 | test_platforms: 4 | - name: win 5 | type: Unity::VM 6 | image: package-ci/win10:stable 7 | flavor: m1.large 8 | --- 9 | {% for editor in test_editors %} 10 | {% for platform in test_platforms %} 11 | promotion_test_{{ platform.name }}_{{ editor.version }}: 12 | name : Promotion Test {{ editor.version }} on {{ platform.name }} 13 | agent: 14 | type: {{ platform.type }} 15 | image: {{ platform.image }} 16 | flavor: {{ platform.flavor}} 17 | variables: 18 | UPMCI_PROMOTION: 1 19 | commands: 20 | - npm install upm-ci-utils@stable -g --registry https://api.bintray.com/npm/unity/unity-npm 21 | - upm-ci package test --unity-version {{ editor.version }} 22 | artifacts: 23 | logs: 24 | paths: 25 | - "upm-ci~/test-results/**/*" 26 | dependencies: 27 | - .yamato/upm-ci.yml#pack 28 | {% endfor %} 29 | {% endfor %} 30 | 31 | promotion_test_trigger: 32 | name: Promotion Tests Trigger 33 | agent: 34 | type: Unity::VM 35 | image: package-ci/win10:stable 36 | flavor: m1.large 37 | artifacts: 38 | logs: 39 | paths: 40 | - "upm-ci~/test-results/**/*" 41 | packages: 42 | paths: 43 | - "upm-ci~/packages/**/*" 44 | dependencies: 45 | {% for editor in test_editors %} 46 | {% for platform in test_platforms %} 47 | - .yamato/promotion.yml#promotion_test_{{platform.name}}_{{editor.version}} 48 | {% endfor %} 49 | {% endfor %} 50 | 51 | promote: 52 | name: Promote to Production 53 | agent: 54 | type: Unity::VM 55 | image: package-ci/win10:stable 56 | flavor: m1.large 57 | variables: 58 | UPMCI_PROMOTION: 1 59 | commands: 60 | - npm install upm-ci-utils@stable -g --registry https://api.bintray.com/npm/unity/unity-npm 61 | - upm-ci package promote 62 | triggers: 63 | tags: 64 | only: 65 | - /^(r|R)elease-\d+\.\d+\.\d+(-preview(\.\d+)?)?$/ 66 | artifacts: 67 | artifacts: 68 | paths: 69 | - "upm-ci~/packages/*.tgz" 70 | dependencies: 71 | - .yamato/upm-ci.yml#pack 72 | {% for editor in test_editors %} 73 | {% for platform in test_platforms %} 74 | - .yamato/promotion.yml#promotion_test_{{ platform.name }}_{{ editor.version }} 75 | {% endfor %} 76 | {% endfor %} -------------------------------------------------------------------------------- /.yamato/upm-ci.yml: -------------------------------------------------------------------------------- 1 | test_editors: 2 | - version: 2019.2 3 | - version: trunk 4 | test_platforms: 5 | - name: win 6 | type: Unity::VM 7 | image: package-ci/win10:stable 8 | flavor: m1.large 9 | - name: mac 10 | type: Unity::VM::osx 11 | image: buildfarm/mac:stable 12 | flavor: m1.mac 13 | --- 14 | pack: 15 | name: Pack 16 | agent: 17 | type: Unity::VM 18 | image: package-ci/win10:stable 19 | flavor: m1.large 20 | commands: 21 | - npm install upm-ci-utils@stable -g --registry https://api.bintray.com/npm/unity/unity-npm 22 | - upm-ci package pack 23 | artifacts: 24 | packages: 25 | paths: 26 | - "upm-ci~/**/*" 27 | 28 | {% for editor in test_editors %} 29 | {% for platform in test_platforms %} 30 | test_{{ platform.name }}_{{ editor.version }}: 31 | name : Test {{ editor.version }} on {{ platform.name }} 32 | agent: 33 | type: {{ platform.type }} 34 | image: {{ platform.image }} 35 | flavor: {{ platform.flavor}} 36 | commands: 37 | - npm install upm-ci-utils@stable -g --registry https://api.bintray.com/npm/unity/unity-npm 38 | - upm-ci package test --unity-version {{ editor.version }} 39 | artifacts: 40 | logs: 41 | paths: 42 | - "upm-ci~/test-results/**/*" 43 | dependencies: 44 | - .yamato/upm-ci.yml#pack 45 | {% endfor %} 46 | {% endfor %} 47 | 48 | test_trigger: 49 | name: Tests Trigger 50 | agent: 51 | type: Unity::VM 52 | image: package-ci/win10:stable 53 | flavor: m1.large 54 | commands: 55 | - dir 56 | triggers: 57 | branches: 58 | only: 59 | - "/.*/" 60 | artifacts: 61 | logs: 62 | paths: 63 | - "upm-ci~/test-results/**/*" 64 | packages: 65 | paths: 66 | - "upm-ci~/packages/**/*" 67 | dependencies: 68 | - .yamato/upm-ci.yml#pack 69 | {% for editor in test_editors %} 70 | {% for platform in test_platforms %} 71 | - .yamato/upm-ci.yml#test_{{platform.name}}_{{editor.version}} 72 | {% endfor %} 73 | {% endfor %} 74 | 75 | publish: 76 | name: Publish to Internal Registry 77 | agent: 78 | type: Unity::VM 79 | image: package-ci/win10:stable 80 | flavor: m1.large 81 | commands: 82 | - npm install upm-ci-utils@stable -g --registry https://api.bintray.com/npm/unity/unity-npm 83 | - upm-ci package publish 84 | triggers: 85 | tags: 86 | only: 87 | - /^(r|R)(c|C)-\d+\.\d+\.\d+(-preview(\.\d+)?)?$/ 88 | artifacts: 89 | artifacts: 90 | paths: 91 | - "upm-ci~/packages/*.tgz" 92 | dependencies: 93 | - .yamato/upm-ci.yml#pack 94 | {% for editor in test_editors %} 95 | {% for platform in test_platforms %} 96 | - .yamato/upm-ci.yml#test_{{ platform.name }}_{{ editor.version }} 97 | {% endfor %} 98 | {% endfor %} -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this package will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 5 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 6 | 7 | ## [1.1.0-preview.5] - 2019-07-23 8 | - Updated contribution guidelines 9 | 10 | ## [1.1.0-preview.3] - 2019-07-17 11 | - Added contribution guidelines 12 | 13 | ## [1.1.0-preview.1] - 2019-05-28 14 | - Fixed main camera issue 15 | 16 | ## [1.0.0-preview.5] - 2019-04-05 17 | - Changed documentation 18 | 19 | ## [1.0.0-preview.4] - 2019-04-05 20 | - Switch CI publishing to Yamato 21 | 22 | ## [1.0.0-preview.3] - 2018-12-11 23 | - Fixed CI for publishing 24 | 25 | ## [1.0.0-preview.2] - 2018-12-07 26 | - Fixed key up/down on console input 27 | 28 | ## [1.0.0-preview.1] - 2018-12-06 29 | - Update to support UIElement 2019.1 30 | 31 | ## [0.0.1-preview.4] - 2018-12-05 32 | ### This is the first release of the *Immediate Window*. 33 | -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d9dc1812bac34a5bba275762ffb1cc3 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## If you are interested in contributing, here are some ground rules: 4 | * First share your plan with us before starting to avoid redundant or disruptive work 5 | * External contributors can use Github issues for that 6 | * Branch of master for hot fixes, or dev for other works 7 | * Please include the ticket ID in your commits (either Jira or Github issue) 8 | 9 | ## All contributions are subject to the [Unity Contribution Agreement(UCA)](https://unity3d.com/legal/licenses/Unity_Contribution_Agreement) 10 | By making a pull request, you are confirming agreement to the terms and conditions of the UCA, including that your Contributions are your original creation and that you have complete right and authority to make your Contributions. 11 | 12 | ## Once you have a change ready following these ground rules. Simply make a pull request 13 | -------------------------------------------------------------------------------- /CONTRIBUTING.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a65755baa562043a1bab83e08694d947 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Documentation~/Images.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e761e6752d0fb4b7eb20e4800ed60f5f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Documentation~/Images/assembly_inspector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/assembly_inspector.png -------------------------------------------------------------------------------- /Documentation~/Images/clear_console_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/clear_console_icon.png -------------------------------------------------------------------------------- /Documentation~/Images/code_snippet_selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/code_snippet_selection.png -------------------------------------------------------------------------------- /Documentation~/Images/collapsed_object_inspection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/collapsed_object_inspection.png -------------------------------------------------------------------------------- /Documentation~/Images/dictionary_collapsed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/dictionary_collapsed.png -------------------------------------------------------------------------------- /Documentation~/Images/expanded_object_inspection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/expanded_object_inspection.png -------------------------------------------------------------------------------- /Documentation~/Images/fully_expanded_object_inspection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/fully_expanded_object_inspection.png -------------------------------------------------------------------------------- /Documentation~/Images/gameobject_inspector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/gameobject_inspector.png -------------------------------------------------------------------------------- /Documentation~/Images/hide_assembly_inspector_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/hide_assembly_inspector_icon.png -------------------------------------------------------------------------------- /Documentation~/Images/multi_view_selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/multi_view_selection.png -------------------------------------------------------------------------------- /Documentation~/Images/multiline_mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/multiline_mode.png -------------------------------------------------------------------------------- /Documentation~/Images/multiline_mode_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/multiline_mode_icon.png -------------------------------------------------------------------------------- /Documentation~/Images/namespace_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/namespace_list.png -------------------------------------------------------------------------------- /Documentation~/Images/namespace_static_object_inspector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/namespace_static_object_inspector.png -------------------------------------------------------------------------------- /Documentation~/Images/namespace_type_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/namespace_type_list.png -------------------------------------------------------------------------------- /Documentation~/Images/quickview_icon_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/quickview_icon_blue.png -------------------------------------------------------------------------------- /Documentation~/Images/run_code_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/run_code_icon.png -------------------------------------------------------------------------------- /Documentation~/Images/simple_dictionary_fullview_inspector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/simple_dictionary_fullview_inspector.png -------------------------------------------------------------------------------- /Documentation~/Images/simple_dictionary_inspector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/simple_dictionary_inspector.png -------------------------------------------------------------------------------- /Documentation~/Images/single_line_input_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/com.unity.immediate-window/ef74cf894ef7bc505b0da58ba29ee3047246b32b/Documentation~/Images/single_line_input_example.png -------------------------------------------------------------------------------- /Documentation~/com.unity.immediate-window.md: -------------------------------------------------------------------------------- 1 | # Immediate Window 2 | 3 | The immediate window is used to instantly evaluate C# code inside the Unity Editor. 4 | 5 | ![Immediate window](Images/dictionary_collapsed.png) 6 | 7 | ## Installation 8 | 9 | The window is accessible through the ```Window/Analysis/Immediate Window``` editor menu. 10 | 11 | ## Overview 12 | 13 | The immediate window lets you run code and inspect returned object and their properties. It's not a tool aim at developement but rather 14 | debug scenarios or editor API discovery. 15 | 16 | ## Usage 17 | 18 | ### Interface Overview 19 | 20 | #### Toolbar 21 | 22 | ###### Reset 23 | 24 | Resets the in-memory assembly state. If you had any variable or class created they will be cleared. Namespaces using will also be reset to default. 25 | 26 | ###### View Private 27 | 28 | View private members when inspecting objects. 29 | 30 | ###### ![](Images/run_code_icon.png) Run Code 31 | 32 | Press this to run the current code. Alternatively, press `Return` when in single-line mode or `Command+Return` on Mac or `Ctrl+Return` on Windows in multiline mode to do the same. 33 | 34 | ###### ![](Images/hide_assembly_inspector_icon.png) Show/Hide Assembly Inspector Toggle 35 | 36 | Show/Hide the Assembly Inspector 37 | 38 | ###### ![](Images/multiline_mode_icon.png) Single/Multiline Mode Toggle 39 | 40 | Toggle between multiline/single line mode (see below for details). 41 | 42 | ###### ![](Images/clear_console_icon.png) Clear Console 43 | 44 | Clears the console of all output. 45 | 46 | #### Keyboard Shortcuts 47 | 48 | ##### Multiline Mode 49 | 50 | * Mac:`Command+Return` - Windows:`Ctrl+Return`: [Run Code](#runCodeHelp) 51 | 52 | ##### Single Line Mode 53 | 54 | * `Return`: [Run Code](#runCodeHelp) 55 | * `Keyboard Up Arrow` - Previous Command 56 | * `Keyboard Down Arrow` - Next Command 57 | 58 | ### Single Line Command 59 | 60 | You can use the single line input to type code and get it to evaluate instantly upon pressing `Return`. 61 | 62 | For example, if you type this code: 63 | 64 | ![Single line code example](Images/single_line_input_example.png) 65 | 66 | you will see this result in the inspector: 67 | 68 | ![Game object inspector](Images/gameobject_inspector.png) 69 | 70 | ### Object Inspection 71 | 72 | #### Basics 73 | 74 | You can use the object inspector to inspect an object and its properties. The object inspector will show the last object of any line of code. So for instance if you type: ```var a = 12; var b = 14``` 75 | You will only see the `b` object in the console. Note that if you added a semicolon `;` at the end of the previous line, you will only see `null` in the console, which is somewhat counter-intuitive. 76 | 77 | Here is an example of an collapsed object inspector, which only shows a quick view of the object: 78 | 79 | ![](Images/collapsed_object_inspection.png) 80 | 81 | Clicking on the object will yield a more detailed view: 82 | 83 | ![](Images/expanded_object_inspection.png) 84 | 85 | You can also click on the `methods` or, if available `interface` groups to view additional details: 86 | 87 | ![](Images/fully_expanded_object_inspection.png) 88 | 89 | #### Type views 90 | 91 | Some types, such as Lists and Dictionaries have specific views in order to simplify their inspection. For instance, viewing a dictionary will yield something like this: 92 | 93 | ![](Images/simple_dictionary_inspector.png) 94 | 95 | Instead of having every property of the object, only the most relevant is show, in this case, the key/value pair. You can notice at the end of the line a blue icon ![](Images/quickview_icon_blue.png) 96 | which, when clicked, will become grey and show the _full_ object view, like this: 97 | 98 | ![](Images/simple_dictionary_fullview_inspector.png) 99 | 100 | In cases where there are _many_ views for a given type, you will see a dropdown like this which will let you select which view to use (in this case, the different views are `Object`, `Complex 1` and `Complex 2`): 101 | 102 | ![](Images/multi_view_selection.png) 103 | 104 | You can also create your own views for your custom type, [as explained here](#typeview). 105 | 106 | ### Multiline Mode 107 | 108 | Multiline mode allows you to write many lines of code at once. You can press `Command+Return` on Mac or `Ctrl+Return` on Windows to run the code in the text field. 109 | 110 | ![](Images/multiline_mode.png) 111 | 112 | #### Code Snippets 113 | 114 | You can start off will pre-made code snippets. There is currently no way to save your own code snippets or have them automatically synced to a file though. 115 | 116 | ![](Images/code_snippet_selection.png) 117 | 118 | ### Assembly Inspector 119 | 120 | ![](Images/assembly_inspector.png) 121 | 122 | The assembly inspector lets you inspect the available loaded assemblies. Clicking on any assembly will list the namespaces within that assembly, as this image illustrate. 123 | 124 | ![](Images/namespace_list.png) 125 | 126 | Then, clicking an any namespace will list every _type which has static properties_. The idea is to browse through types 127 | which have actual static items to view when debugging the current state of some editor component. This way you can browse through all your instances easily. 128 | Ideally there would be some toggle to list every type or only this subset. 129 | 130 | ![](Images/namespace_type_list.png) 131 | 132 | Finally, when clicking on any type's properties, you it will output the object for inspection in the console, as the image below, where the `SomeStaticObject` property has been clicked. 133 | 134 | ![](Images/namespace_static_object_inspector.png) 135 | 136 | ### Namespace References 137 | 138 | You can add new namespace reference by simply using the [Assembly Inspector](#assemblyInspector) and clicking on any namespace (a ✓ checkmark will appear next to it). 139 | 140 | This way, you don't have to type `My.Very.Long.Namespace.MyObject` and can simply type `MyObject` directly. 141 | 142 | For simplicity of usage, these namespaces are automatically added in every coding session. Unfortunately, you can not remove them, so in the future, better control 143 | should be given over these. 144 | 145 | ``` 146 | "UnityEngine", 147 | "UnityEditor", 148 | "System", 149 | "System.Collections", 150 | "System.Collections.Generic", 151 | "System.Linq" 152 | ``` 153 | 154 | ### Creating your own type view 155 | 156 | Simply create a class that implements `ITypeView` and you're good to go! Inspectors on your type will automatically be using your new view. 157 | 158 | You also inherits form `ATypeView` which already provides a default implementation of most detail methods. You really only need to implement `GetView` in this case. 159 | 160 | If you want to experiment with creating a custom type view, you can look at the `Custom Type View` and `Custom Expandable Type View` reference implementations in the 161 | [Code Snippets](#codeSnippets) dropdown of the multiline view. Currently this will only output the correct inspector to the console when run once due to an unknown bug, 162 | so it's not exactly suitable for iterating with yet. 163 | 164 | # Author Contact 165 | 166 | Mathieu Rivest 167 | mathieur@unity3d.com 168 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4b052e48c8fb4079bda74b557cfa46b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using UnityEditor.UIElements; 3 | 4 | #if UNITY_2018_3_OR_NEWER 5 | [assembly: UxmlNamespacePrefix("UnityEditor.ImmediateWindow.UI", "imw")] 6 | #endif 7 | -------------------------------------------------------------------------------- /Editor/AssemblyInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddcd77a83a5b441308cd12e68d6a7614 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52da467fe451e4d3f971768eb39d10ee 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Resources/Styles.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15d005cd59d1242dfbebc79c5f684d96 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Resources/Styles/Main_Dark.scss: -------------------------------------------------------------------------------- 1 | /*************************************************************************************************** 2 | 3 | *** Auto-Generated - Do not modify .uss File *** 4 | 5 | Only Modify Main.scss 6 | 7 | ***************************************************************************************************/ 8 | 9 | //-------------------------------------------------------------------------------------------------- 10 | // Pure theme colors 11 | //-------------------------------------------------------------------------------------------------- 12 | 13 | $unity-text-color: #b4b4b4; 14 | $unity-list-hover-background: #484848; 15 | $unity-list-selected-background: #3e5f96; 16 | $unity-background: #383838; 17 | 18 | //-------------------------------------------------------------------------------------------------- 19 | // Custom colors 20 | //-------------------------------------------------------------------------------------------------- 21 | 22 | $unity-background-light-contrast: #3c3c3c; // For dark contrast, use: #404040 and #232323 23 | $unity-background-dark-contrast: #707070; // $ 24 | $unity-text-color-highlight: #f4f4f4; 25 | 26 | $unity-installed-color-highlight: rgba(255,255,254,0.4); 27 | $not-installed-package-background-color: #424242; 28 | 29 | $package-tag-color: #ffa44e; 30 | $package-tag-recommended-color: #e4e4e4; 31 | 32 | $caret-text-color: #646464; 33 | 34 | $link-text-color: #4F80F8; 35 | 36 | $text-faded: rgba(255, 255, 255, 0.5); 37 | $property-label-enumerable: #954F9B; 38 | $property-label: #E16DEA; 39 | $property-label-private: #EB8752; 40 | 41 | $value-string: #E83F3B; 42 | $value-number: #9079F0; 43 | $value-null: $value-number; 44 | 45 | $method-name: #A1F7B5; 46 | $method-argument: #5CB0D7; 47 | $method-return: rgba(181, 65, 194, 0.89); 48 | 49 | //-------------------------------------------------------------------------------------------------- 50 | // Custom backgrounds 51 | //-------------------------------------------------------------------------------------------------- 52 | $installed-package-background: resource("Builtin Skins/DarkSkin/Images/MenuItemOn.png"); 53 | 54 | $background-left-button: resource("Builtin Skins/DarkSkin/Images/btn left.png"); 55 | $background-left-button-selected: resource("Builtin Skins/DarkSkin/Images/btn left on.png");; 56 | $background-mid-button: resource("Builtin Skins/DarkSkin/Images/btn mid.png"); 57 | $background-mid-button-selected: resource("Builtin Skins/DarkSkin/Images/btn mid on.png"); 58 | $background-right-button: resource("Builtin Skins/DarkSkin/Images/btn right.png"); 59 | $background-right-button-selected: resource("Builtin Skins/DarkSkin/Images/btn right on.png"); 60 | 61 | $background-button-slice-right: 0; 62 | $background-button-slice-left: 0; 63 | $background-button-slice-middle: 1; 64 | 65 | $background-status-outdated: resource("Images/Dark/download"); 66 | $background-status-error: resource("Images/Dark/error"); 67 | 68 | $background-spinner-normal: resource("Images/Dark/loading"); 69 | $background-spinner-large: resource("Images/Dark/loading"); 70 | 71 | $popup-background: resource("Builtin Skins/DarkSkin/Images/mini popup.png"); 72 | 73 | $toolbar-background: resource("Builtin Skins/DarkSkin/Images/Toolbar.png"); 74 | $toolbar-button-background: resource("Builtin Skins/DarkSkin/Images/toolbar button.png"); 75 | $toolbar-button-active-background: resource("Builtin Skins/DarkSkin/Images/toolbar button act.png"); 76 | $toolbar-button-pulldown-background: resource("Builtin Skins/DarkSkin/Images/toolbar pulldown.png"); 77 | $toolbar-button-popup-background: resource("Builtin Skins/DarkSkin/Images/toolbar popup.png"); 78 | $toolbar-search-textfield-background: resource("Builtin Skins/DarkSkin/Images/toolbarsearch.png"); 79 | $toolbar-search-textfield-focus-background: resource("Builtin Skins/DarkSkin/Images/toolbarsearch focused.png"); 80 | $toolbar-search-cancel-background: resource("Builtin Skins/DarkSkin/Images/toolbarsearchCancelButton.png"); 81 | $toolbar-search-cancel-active-background: resource("Builtin Skins/DarkSkin/Images/toolbarsearchCancelButtonActive.png"); 82 | $toolbar-search-cancel-off-background: resource("Builtin Skins/DarkSkin/Images/toolbarsearchCancelButtonOff.png"); 83 | 84 | $cancel-background: resource("Builtin Skins/DarkSkin/Images/ShurikenCheckMarkMixed.png"); 85 | $cancel-pressed-background: resource("Builtin Skins/DarkSkin/Images/ShurikenCheckMarkNormal.png"); 86 | $popup-background: resource("Builtin Skins/DarkSkin/Images/popup.png"); 87 | $popup-pressed-background: resource("Builtin Skins/DarkSkin/Images/popup act.png"); 88 | $play-background: resource("Builtin Skins/DarkSkin/Images/IN foldout act.png"); 89 | $play-pressed-background: resource("Builtin Skins/DarkSkin/Images/IN foldout.png"); 90 | $context-background: resource("Builtin Skins/DarkSkin/Images/ShurikenModuleActive.png"); 91 | $context-pressed-background: resource("Builtin Skins/DarkSkin/Images/ShurikenEmitterActive.png"); 92 | 93 | $icon-node0: resource("Builtin Skins/DarkSkin/Images/node0 hex.png"); 94 | $icon-node0-on: resource("Builtin Skins/DarkSkin/Images/node0 hex on.png"); 95 | $icon-node1: resource("Builtin Skins/DarkSkin/Images/node1 hex.png"); 96 | $icon-node1-on: resource("Builtin Skins/DarkSkin/Images/node1 hex on.png"); 97 | $icon-node2: resource("Builtin Skins/DarkSkin/Images/node2 hex.png"); 98 | $icon-node2-on: resource("Builtin Skins/DarkSkin/Images/node2 hex on.png"); 99 | 100 | //-------------------------------------------------------------------------------------------------- 101 | // Common stylesheet 102 | //-------------------------------------------------------------------------------------------------- 103 | @import "common"; 104 | -------------------------------------------------------------------------------- /Editor/Resources/Styles/Main_Dark.scss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 815f04870b5a8487a99d29714023e2a9 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Resources/Styles/Main_Dark.uss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cde256333961e4e90b7b4ff73a7ab08d 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: stylesheet 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} 11 | -------------------------------------------------------------------------------- /Editor/Resources/Styles/Main_Light.scss: -------------------------------------------------------------------------------- 1 | /*************************************************************************************************** 2 | 3 | *** Auto-Generated - Do not modify .uss File *** 4 | 5 | Only Modify Main.scss 6 | 7 | ***************************************************************************************************/ 8 | 9 | //-------------------------------------------------------------------------------------------------- 10 | // Pure theme colors 11 | //-------------------------------------------------------------------------------------------------- 12 | 13 | $unity-text-color: #000000; 14 | $unity-list-hover-background: #8f8f8f; 15 | $unity-list-selected-background: #3e7de7; 16 | $unity-background: #c2c2c2; 17 | 18 | //-------------------------------------------------------------------------------------------------- 19 | // Custom colors 20 | //-------------------------------------------------------------------------------------------------- 21 | 22 | $unity-background-light-contrast: #D5D5D5; 23 | $unity-background-dark-contrast: #6C6C6C; 24 | $unity-text-color-highlight: #f4f4f4; 25 | 26 | $unity-installed-color-highlight: rgba(1,0,0,0.3); 27 | $not-installed-package-background-color: #d1d1d1; 28 | 29 | $package-tag-color: #d25a00; 30 | $package-tag-recommended-color: #000; 31 | 32 | $caret-text-color: #646464; 33 | 34 | $link-text-color: #0808FC; 35 | 36 | $text-faded: rgba(0, 0, 0, 0.5); 37 | $property-label-enumerable: $text-faded; 38 | $property-label: rgb(142, 34, 150); 39 | $property-label-private: rgb(185, 86, 0); 40 | 41 | $value-string: rgb(197, 25, 22); 42 | $value-number: rgb(28, 1, 210); 43 | $value-null: $value-number; 44 | 45 | $method-name: #B12697; 46 | $method-argument: $value-number; 47 | $method-return: $unity-background-dark-contrast; 48 | 49 | //-------------------------------------------------------------------------------------------------- 50 | // Custom backgrounds 51 | //-------------------------------------------------------------------------------------------------- 52 | $installed-package-background: resource("Builtin Skins/LightSkin/Images/MenuItemOn.png"); 53 | 54 | $background-left-button: resource("Builtin Skins/LightSkin/Images/btn left.png"); 55 | $background-left-button-selected: resource("Builtin Skins/LightSkin/Images/btn left on.png");; 56 | $background-mid-button: resource("Builtin Skins/LightSkin/Images/btn mid.png"); 57 | $background-mid-button-selected: resource("Builtin Skins/LightSkin/Images/btn mid on.png"); 58 | $background-right-button: resource("Builtin Skins/LightSkin/Images/btn right.png"); 59 | $background-right-button-selected: resource("Builtin Skins/LightSkin/Images/btn right on.png"); 60 | 61 | $background-button-slice-right: 6; 62 | $background-button-slice-left: 6; 63 | $background-button-slice-middle: 1; 64 | 65 | $background-status-outdated: resource("Images/Light/download"); 66 | $background-status-error: resource("Images/Dark/error"); 67 | 68 | $background-spinner-normal: resource("Images/Light/loading"); 69 | $background-spinner-large: resource("Images/Light/loading"); 70 | 71 | $popup-background: resource("Builtin Skins/LightSkin/Images/mini popup.png"); 72 | 73 | $toolbar-background: resource("Builtin Skins/LightSkin/Images/Toolbar.png"); 74 | $toolbar-button-background: resource("Builtin Skins/LightSkin/Images/toolbar button.png"); 75 | $toolbar-button-active-background: resource("Builtin Skins/LightSkin/Images/toolbar button act.png"); 76 | $toolbar-button-pulldown-background: resource("Builtin Skins/LightSkin/Images/toolbar pulldown.png"); 77 | $toolbar-button-popup-background: resource("Builtin Skins/LightSkin/Images/toolbar popup.png"); 78 | $toolbar-search-textfield-background: resource("Builtin Skins/LightSkin/Images/toolbarsearch.png"); 79 | $toolbar-search-textfield-focus-background: resource("Builtin Skins/LightSkin/Images/toolbarsearch focused.png"); 80 | $toolbar-search-cancel-background: resource("Builtin Skins/LightSkin/Images/toolbarsearchCancelButton.png"); 81 | $toolbar-search-cancel-active-background: resource("Builtin Skins/LightSkin/Images/toolbarsearchCancelButtonActive.png"); 82 | $toolbar-search-cancel-off-background: resource("Builtin Skins/LightSkin/Images/toolbarsearchCancelButtonOff.png"); 83 | 84 | $cancel-background: resource("Builtin Skins/LightSkin/Images/ol minus.png"); 85 | $cancel-pressed-background: resource("Builtin Skins/LightSkin/Images/ol minus act.png"); 86 | $popup-background: resource("Builtin Skins/LightSkin/Images/popup.png"); 87 | $popup-pressed-background: resource("Builtin Skins/LightSkin/Images/popup act.png"); 88 | $play-background: resource("Builtin Skins/LightSkin/Images/IN foldout act.png"); 89 | $play-pressed-background: resource("Builtin Skins/LightSkin/Images/IN foldout.png"); 90 | $context-background: resource("Builtin Skins/LightSkin/Images/ShurikenModuleActive.png"); 91 | $context-pressed-background: resource("Builtin Skins/LightSkin/Images/ShurikenEmitterActive.png"); 92 | 93 | $icon-node0: resource("Builtin Skins/LightSkin/Images/node0 hex.png"); 94 | $icon-node0-on: resource("Builtin Skins/LightSkin/Images/node0 hex on.png"); 95 | $icon-node1: resource("Builtin Skins/LightSkin/Images/node1 hex.png"); 96 | $icon-node1-on: resource("Builtin Skins/LightSkin/Images/node1 hex on.png"); 97 | $icon-node2: resource("Builtin Skins/LightSkin/Images/node2 hex.png"); 98 | $icon-node2-on: resource("Builtin Skins/LightSkin/Images/node2 hex on.png"); 99 | 100 | //-------------------------------------------------------------------------------------------------- 101 | // Common stylesheet 102 | //-------------------------------------------------------------------------------------------------- 103 | @import "common"; 104 | -------------------------------------------------------------------------------- /Editor/Resources/Styles/Main_Light.scss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 760cb60b127c04a6b9570374f3988782 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Resources/Styles/Main_Light.uss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 685b5a2cf1a9740f284941a10131e03f 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: stylesheet 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} 11 | -------------------------------------------------------------------------------- /Editor/Resources/Styles/_common.scss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 758496e2795624839a966e27d5ef807f 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Resources/Templates.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf9b389c625f04dc88e6bbafa4e42ffa 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/Alert.uxml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/Alert.uxml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b7b38a70ba204ef9b9728dd77e242de 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: tree 6 | 11400002: inlineStyle 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} 12 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/Console.uxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/Console.uxml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: daf1b2945700f4091b505bbb94a6609c 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: tree 6 | 11400002: inlineStyle 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} 12 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/ConsoleOutput.uxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/ConsoleOutput.uxml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f8fceccfd5774c3cad7e9eec1228a39 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: tree 6 | 11400002: inlineStyle 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} 12 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/ConsoleToolbar.uxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/ConsoleToolbar.uxml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5362f3744e50e4dee80b433dcb5474b8 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: tree 6 | 11400002: inlineStyle 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} 12 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/Context.uxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/Context.uxml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee6be7e6c81e94c15b9f6bf65ab29e54 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: tree 6 | 11400002: inlineStyle 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} 12 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/ImmediateWindow.uxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/ImmediateWindow.uxml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f3c5a1a3fc8fc476bb090d48742b66e4 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: tree 6 | 11400002: inlineStyle 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} 12 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/OutputItem.uxml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/OutputItem.uxml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0b7c5b9ddc24c4a79a5044b47960f860 3 | ScriptedImporter: 4 | fileIDToRecycleName: 5 | 11400000: tree 6 | 11400002: inlineStyle 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} 12 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/UIElementsSchema.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a03df67578224c10aabe9653d9eb74b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/UIElementsSchema/UIElements.xsd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/UIElementsSchema/UIElements.xsd.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 37a45680e2f5f40cd8ad720daad61f6f 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/UIElementsSchema/UnityEditor.Experimental.UIElements.xsd.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a46e91273b2845c19cd3443136d6a80 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/UIElementsSchema/UnityEditor.ImmediateWindow.UI.xsd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/UIElementsSchema/UnityEditor.ImmediateWindow.UI.xsd.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd5730f8f8ed84dc0aedf3d521171c67 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Resources/Templates/UIElementsSchema/UnityEngine.Experimental.UIElements.xsd.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b3cd853e4c24400691fdbba762e5940 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Sources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9db772508c39436daec2fbf7055c5c2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/Services.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a6694c8ab26ae45a28910e09accd0d28 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Analytics.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09db9831d3a3f4a94a9fd5faf693a1e5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Analytics/ImmediateWindowAnalytics.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UnityEditor.ImmediateWindow.UI 4 | { 5 | [Serializable] 6 | public struct ImmediateWindowAnalytics 7 | { 8 | public bool MultilineMode; 9 | }; 10 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/Analytics/ImmediateWindowAnalytics.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5628a5eed48df40d7891e370e88026b9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Code.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c953ca809ce9b4946a2eae29dec6274a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Code/Evaluator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.CodeAnalysis; 6 | using Microsoft.CodeAnalysis.CSharp; 7 | using UnityEngine; 8 | using Microsoft.CodeAnalysis.CSharp.Scripting; 9 | using Microsoft.CodeAnalysis.Scripting; 10 | using Microsoft.CodeAnalysis.Recommendations; 11 | using Microsoft.CodeAnalysis.Text; 12 | using UnityEditor.ImmediateWindow.Services; 13 | 14 | namespace UnityEditor.ImmediateWindow.Services 15 | { 16 | // Evaluation Manager 17 | internal class Evaluator 18 | { 19 | private static Evaluator instance = new Evaluator(); 20 | public static Evaluator Instance { get { return instance; } } 21 | 22 | public event Action OnEvaluationSuccess = delegate { }; 23 | public event Action OnEvaluationError = delegate { }; 24 | public event Action OnBeforeEvaluation = delegate { }; 25 | 26 | private AdhocWorkspace Workspace { get; set; } 27 | private SourceText Text { get; set; } 28 | private string Code { get; set; } 29 | 30 | private Globals Globals { get; set; } 31 | private ScriptState ScriptState { get; set; } 32 | 33 | public static void Init(ref Evaluator value) 34 | { 35 | if (value == null) // UI window opened 36 | { 37 | value = instance; 38 | } 39 | else // Domain reload 40 | { 41 | instance = value; 42 | } 43 | } 44 | 45 | public Evaluator() 46 | { 47 | Init(); 48 | } 49 | 50 | public async void Init() 51 | { 52 | SymbolCount = 1; 53 | Globals = new Globals(); 54 | List references = new List(); 55 | foreach(var assembly in Inspector.GetReferencableAssemblies()) 56 | references.Add(MetadataReference.CreateFromFile(assembly.Location)); 57 | 58 | /* For easier debugging 59 | references.Add(MetadataReference.CreateFromFile(typeof(Evaluator).Assembly.Location)); 60 | references.Add(MetadataReference.CreateFromFile(typeof(UnityEditor.BuildOptions).Assembly.Location)); 61 | references.Add(MetadataReference.CreateFromFile(typeof(UnityEngine.Application).Assembly.Location)); 62 | */ 63 | 64 | var options = ScriptOptions.Default.WithReferences(references); 65 | 66 | ScriptState = await CSharpScript.RunAsync("", options, globals: Globals); 67 | 68 | // Set some default common namespaces for easier debugging 69 | await AddNamespace(new List 70 | { 71 | "UnityEngine", 72 | "UnityEditor", 73 | "System", 74 | "System.Collections", 75 | "System.Collections.Generic", 76 | "System.Linq" 77 | }); 78 | 79 | /* Test using workspaces 80 | string _text = 81 | @"using System;using UnityE 82 | namespace TEST 83 | { 84 | public class MyClass 85 | { 86 | public static void Print() 87 | { 88 | Console.WriteLine(""Hello World""); 89 | } 90 | } 91 | }"; 92 | Workspace = new AdhocWorkspace(); 93 | string projName = "Immediate Window"; 94 | ProjectId projId = ProjectId.CreateNewId(); 95 | VersionStamp versionStamp = VersionStamp.Create(); 96 | ProjectInfo projInfo = ProjectInfo.Create(projId, versionStamp, projName, projName, LanguageNames.CSharp); 97 | SourceText sourceText = SourceText.From(_text); 98 | 99 | projInfo = projInfo.WithMetadataReferences(references); 100 | Workspace.AddProject(projInfo); 101 | Document doc = Workspace.AddDocument(Workspace.CurrentSolution.ProjectIds[0], "console.cs", sourceText); 102 | 103 | SemanticModel semanticModel = doc.GetSemanticModelAsync().Result; 104 | 105 | IEnumerable diagnostics = semanticModel.GetDiagnostics(); 106 | IEnumerable symbols = Recommender.GetRecommendedSymbolsAtPositionAsync(semanticModel, 25, Workspace).Result; 107 | foreach (var symbol in symbols) 108 | { 109 | Debug.Log($"Symbol: {symbol.Name}"); 110 | } 111 | */ 112 | } 113 | 114 | public async Task Evaluate(string code) 115 | { 116 | OnBeforeEvaluation(code); 117 | var error = await EvaluateSilently(code); 118 | 119 | // Don't call delegate method in try/catch block to avoid silencing throws 120 | if (error == null) 121 | OnEvaluationSuccess(ScriptState.ReturnValue); 122 | else 123 | { 124 | var message = string.Join(Environment.NewLine, error.Diagnostics); 125 | OnEvaluationError(message, error); 126 | } 127 | } 128 | 129 | // Evaluate without telling the delegates 130 | public async Task EvaluateSilently(string code) 131 | { 132 | CompilationErrorException error = null; 133 | try 134 | { 135 | ScriptState = await ScriptState.ContinueWithAsync(code); 136 | } 137 | catch (CompilationErrorException e) 138 | { 139 | error = e; 140 | } 141 | 142 | return error; 143 | } 144 | 145 | private Action OnUnRegister; 146 | private int SymbolCount = 1; // 0 is reserved for generic objects 147 | 148 | /** 149 | * The idea here is to create a shorthand for an object that is typed as the object so as to be easily used 150 | * To achieve that, we assign the given object to a reserved global generic object, and then create a variable that is casted to the correct type for that symbol 151 | */ 152 | public async Task AddToNextGlobal(object obj, Action onUnRegister = null) 153 | { 154 | var targetType = obj.GetType(); 155 | var symbol = "_0"; 156 | 157 | if (targetType.IsVisible) 158 | { 159 | var parsed = new ParsedAssemblyQualifiedName.ParsedAssemblyQualifiedName(targetType.AssemblyQualifiedName); 160 | 161 | symbol = string.Format("_{0}", SymbolCount++); 162 | Globals._ImmediateWindowReservedGlobal = obj; 163 | var code = string.Format("var {0} = _ImmediateWindowReservedGlobal as {1};", 164 | symbol, parsed.CSharpStyleName.Value); 165 | var error = await EvaluateSilently(code); 166 | 167 | if (error != null) 168 | Debug.Log("Error while trying to add a symbol: " + error.Message + " -- Code: " + code + "\n"); 169 | } 170 | 171 | if (OnUnRegister != null) 172 | OnUnRegister(); 173 | 174 | OnUnRegister = onUnRegister; 175 | 176 | return symbol; 177 | } 178 | 179 | // More then a little possibly not the best way to do this. There has to be a more 180 | // solid way to add a namespace without simply re-evaluating. 181 | public async Task AddNamespace(string ns) 182 | { 183 | return await AddNamespace(new List {ns}); 184 | } 185 | 186 | public async Task AddNamespace(IEnumerable namespaces) 187 | { 188 | State.Instance.Namespaces.AddRange(namespaces); 189 | 190 | var code = ""; 191 | foreach (var ns in namespaces) 192 | code += $"using {ns};\n"; 193 | 194 | var error = await EvaluateSilently(code); 195 | if (error != null) 196 | Debug.Log("Error adding namespace: " + error.Message + "\n\n" + code); 197 | 198 | return error; 199 | } 200 | 201 | public void GetAutocomplete(string code) 202 | { 203 | /* 204 | var syntaxTree = ScriptState.Script.GetCompilation().SyntaxTrees.First(); 205 | var semanticModel = ScriptState.Script.GetCompilation().GetSemanticModel(syntaxTree); 206 | 207 | AdhocWorkspace workspace = new AdhocWorkspace(); 208 | var symbols = await Recommender.GetRecommendedSymbolsAtPositionAsync(semanticModel, code.Length - 2, workspace); 209 | foreach (var symbol in symbols) 210 | { 211 | Debug.Log($"Symbol: {symbol.Name}"); 212 | } 213 | */ 214 | } 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Code/Evaluator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6a3de24ab3574029a5fb20e050f62be 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Code/Globals.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using UnityEditor.ImmediateWindow.TestObjects; 4 | using UnityEditor.ImmediateWindow.UI; 5 | using UnityEngine; 6 | 7 | namespace UnityEditor.ImmediateWindow.Services 8 | { 9 | /// 10 | /// Object containing global variables used for shortcuts in debugging purposes 11 | /// 12 | public class Globals 13 | { 14 | public object __0; 15 | public object __1; 16 | public object __2; 17 | public object __3; 18 | public object __4; 19 | public object __5 = new Dictionary { {"my", 10}, {"yessir", 20} }; 20 | public object __6 = new List {"test", "yes"}; 21 | public object __7 = new SecretStruct(); 22 | public object __8 = SimpleObject.Create(); 23 | public object __9 = ComplexObject.Create(); 24 | 25 | public object _ImmediateWindowReservedGlobal; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Code/Globals.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a12681afb9ef477384ddd97b0c5b68a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Code/Inspector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using UnityEngine; 6 | 7 | namespace UnityEditor.ImmediateWindow.Services 8 | { 9 | internal class Inspector 10 | { 11 | public Inspector() 12 | { 13 | } 14 | 15 | public static IEnumerable GetLoadableTypes(Assembly assembly) { 16 | if (assembly == null) throw new ArgumentNullException("assembly"); 17 | 18 | try { 19 | return assembly.GetTypes(); 20 | } catch (ReflectionTypeLoadException e) { 21 | return e.Types.Where(t => t != null); 22 | } 23 | } 24 | 25 | /// 26 | /// Get all types of a specific type/interface in an assembly 27 | /// 28 | /// Assembly to check 29 | /// Type (can be Interface type) 30 | /// 31 | public static IEnumerable GetTypesWithInterface(Assembly assembly, Type type) { 32 | return GetLoadableTypes(assembly).Where(type.IsAssignableFrom).ToList(); 33 | } 34 | 35 | public static IEnumerable GetTypesWithInterface(Type type) 36 | { 37 | var types = new List(); 38 | foreach (var assembly in GetAllAssemblies()) 39 | types.AddRange(GetTypesWithInterface(assembly, type)); 40 | 41 | return types; 42 | } 43 | 44 | public static IEnumerable GetAllTypesWithStaticPropertiesForAssembly(Assembly assembly) 45 | { 46 | var result = new List(); 47 | if (assembly.IsDynamic) 48 | return result; 49 | 50 | Type[] types; 51 | try 52 | { 53 | types = assembly.GetTypes(); 54 | } 55 | catch (ReflectionTypeLoadException e) 56 | { 57 | var message = $"Could not load types for assembly (some types in this assembly might refer to assemblies that are not referenced): {assembly.FullName}\n"; 58 | foreach (var except in e.LoaderExceptions) 59 | message += "\n -- Loader exception: " + except.Message; 60 | 61 | Debug.LogWarning(message); 62 | 63 | types = e.Types.Where(t => t != null).ToArray(); 64 | } 65 | 66 | foreach (Type t in types.Where(t => 67 | t != null && 68 | !t.IsInterface && 69 | !t.IsAbstract && 70 | !t.IsEnum && 71 | !t.ContainsGenericParameters)) 72 | { 73 | if (!t.IsClass && !t.IsValueType) continue; 74 | 75 | var staticProperties = t.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); 76 | if (!staticProperties.Any()) continue; 77 | 78 | result.Add(t); 79 | } 80 | 81 | return result; 82 | } 83 | 84 | public static IEnumerable GetAllStaticInstancesForType(Type type) 85 | { 86 | var propertyInfos = new List(); 87 | 88 | if (!type.IsClass && !type.IsValueType) return propertyInfos; 89 | 90 | var staticProperties = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); 91 | 92 | if (!staticProperties.Any()) return propertyInfos; 93 | 94 | // TODO: Big duplicate of GetPropertyInfo 95 | foreach (var p in staticProperties) 96 | { 97 | propertyInfos.Add(new UI.PropertyInfo {Field = p, Object = type, IsPrivate = p.IsPrivate}); 98 | } 99 | 100 | foreach (var prop in type.GetProperties()) 101 | { 102 | if (prop.GetGetMethod() == null) 103 | continue; 104 | 105 | // TODO: Technically should not skip them but simply mark them as such in the inspector 106 | if (prop.GetCustomAttributes().OfType().Any()) 107 | continue; 108 | 109 | // TODO: Technically should at least add those. Just can't show the value (since they take arguments) 110 | if (prop.GetGetMethod().GetParameters().Any()) 111 | continue; 112 | 113 | propertyInfos.Add(new UI.PropertyInfo {Field = null, Property = prop, IsPrivate = false, Object = type}); 114 | } 115 | 116 | return propertyInfos; 117 | } 118 | 119 | public static IEnumerable GetAllTypesWithStaticPropertiesForAssemblyNamespace(Assembly assembly, string ns) 120 | { 121 | return GetAllTypesWithStaticPropertiesForAssembly(assembly).Where(t => t.Namespace == ns); 122 | } 123 | 124 | public static IEnumerable GetAllAssemblies() 125 | { 126 | AppDomain app = AppDomain.CurrentDomain; 127 | var allAssemblies = app.GetAssemblies(); 128 | 129 | return allAssemblies; 130 | } 131 | 132 | // Get list of all relevant assemblies 133 | // Currently not taking all assemblies because it caused an issue when setting up 134 | // the code analyser. Need to investigate. 135 | public static IEnumerable GetRelevantAssemblies(bool includeSystem = false) 136 | { 137 | AppDomain app = AppDomain.CurrentDomain; 138 | var allAssemblies = app.GetAssemblies(); 139 | 140 | // Note: Jetbrains assembly loading throws exception. Needs to investigate 141 | var assemblies = allAssemblies 142 | .Where(assembly => assembly.FullName.ToLower().Contains("unity")) 143 | .OrderBy(assembly => assembly.FullName).ToList(); 144 | 145 | // Add system assemblies at the end (until I have assembly/namespace filtering) 146 | if (includeSystem) 147 | assemblies.AddRange(allAssemblies.Where(assembly => assembly.FullName.Contains("System"))); 148 | 149 | return assemblies; 150 | } 151 | 152 | public static IEnumerable GetReferencableAssemblies() 153 | { 154 | return GetAllAssemblies().Where(assembly => !assembly.IsDynamic && !string.IsNullOrEmpty(assembly.Location)); 155 | } 156 | 157 | public static IEnumerable GetAllNamespaces(Assembly assembly) 158 | { 159 | return GetLoadableTypes(assembly) 160 | .Select(t => t.Namespace) 161 | .Distinct() 162 | .OrderBy(ns => ns); 163 | } 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Code/Inspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c364307b2ac4b48eda7252f76496ab3a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Common.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ebc300871a1694b438adeb3124c706d1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Common/Config.cs: -------------------------------------------------------------------------------- 1 | namespace UnityEditor.ImmediateWindow.UI 2 | { 3 | internal struct Config 4 | { 5 | public static int ShowMaxCollapsedProperties = 10; 6 | public static int ShowMaxCollapsedArrayItems = 5; 7 | public static int ShowMaxBlockProperties = 100; 8 | public static int ShowMaxArrayProperties = 100; 9 | } 10 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/Common/Config.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd78a39d58a564533b66886169ec19b5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Common/PropertyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using UnityEngine; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | public struct PropertyInfo 8 | { 9 | public FieldInfo Field; 10 | public System.Reflection.PropertyInfo Property; 11 | public bool IsPrivate; 12 | public object Object; 13 | 14 | 15 | public string Label {get {return Field != null ? Field.Name : Property.Name;}} 16 | 17 | public bool GeneratesExceptions 18 | { 19 | get 20 | { 21 | // These generate exception with a Type. So skip until I know why 22 | if (Label == "GenericParameterAttributes" || Label == "GenericParameterPosition" || 23 | Label == "DeclaringMethod") 24 | return true; 25 | 26 | return false; 27 | } 28 | } 29 | 30 | public object Value 31 | { 32 | get 33 | { 34 | object value = null; 35 | 36 | if (!GeneratesExceptions) 37 | { 38 | try 39 | { 40 | value = Field != null 41 | ? Field.GetValue(Object) 42 | : Property.GetValue(Object, null); 43 | } 44 | catch (Exception error) 45 | { 46 | var message = "Could not get property value: " + Label + " -- " + error.Message; 47 | if (error.StackTrace != null) 48 | message += "\n\nStack trace: " + error.StackTrace; 49 | if (error.InnerException != null) 50 | message += "\n\n\nInner Exception: " + error.InnerException.Message; 51 | 52 | Debug.LogError(message); 53 | } 54 | } 55 | 56 | return value; 57 | } 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/Common/PropertyInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c7bc7def060f462bb0e1104420c602d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Common/PropertyUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Reflection; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | internal class PropertyUtils 8 | { 9 | public static bool ShowPrivate = true; 10 | 11 | public static IEnumerable GetPropertyInfo(object obj) 12 | { 13 | var properties = new List(); 14 | var type = obj.GetType(); 15 | 16 | // Possibly: PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetProperty); 17 | var privateBindingFlags = 18 | BindingFlags.NonPublic | BindingFlags.Instance | 19 | BindingFlags.FlattenHierarchy; // Allow private properties 20 | var publicProperties = type.GetFields().ToList(); 21 | var privateProperties = type.GetFields(privateBindingFlags).ToList(); 22 | 23 | foreach (var field in publicProperties) 24 | properties.Add(new PropertyInfo {Field = field, Property = null, IsPrivate = false, Object = obj}); 25 | 26 | foreach (var prop in type.GetProperties()) 27 | { 28 | if (prop.GetGetMethod() == null) 29 | continue; 30 | 31 | // TODO: Technically should not skip them but simply mark them as such in the inspector 32 | if (prop.GetCustomAttributes().OfType().Any()) 33 | continue; 34 | 35 | // TODO: Technically should at least add those. Just can't show the value (since they take arguments) 36 | if (prop.GetGetMethod().GetParameters().Any()) 37 | continue; 38 | 39 | properties.Add(new PropertyInfo {Field = null, Property = prop, IsPrivate = false, Object = obj}); 40 | } 41 | 42 | if (ShowPrivate) 43 | { 44 | foreach (var prop in privateProperties) 45 | properties.Add(new PropertyInfo {Field = prop, IsPrivate = true, Object = obj}); 46 | } 47 | 48 | 49 | return properties; 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/Common/PropertyUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e7e6a71280754d208e97125cb1501d1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Common/Resources.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UIElements; 2 | 3 | namespace UnityEditor.ImmediateWindow.UI 4 | { 5 | // NOTE: Duplicated from Package Manager UI 6 | public static class Resources 7 | { 8 | private static string TemplateRoot { get { return ImmediateWindow.ResourcesPath + "Templates"; } } 9 | 10 | private static string TemplatePath(string filename) 11 | { 12 | return string.Format("{0}/{1}", TemplateRoot, filename); 13 | } 14 | 15 | public static VisualElement GetTemplate(string templateFilename) 16 | { 17 | return AssetDatabase.LoadAssetAtPath(TemplatePath(templateFilename)).CloneTree(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/Common/Resources.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 824bb0ca925b74d47914f731345d94f2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Common/UIUtils.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UIElements; 2 | 3 | namespace UnityEditor.ImmediateWindow.UI 4 | { 5 | internal static class UIUtils 6 | { 7 | public static void SetElementDisplay(VisualElement element, bool value) 8 | { 9 | if (element == null) 10 | return; 11 | 12 | element.style.display = value ? DisplayStyle.Flex : DisplayStyle.None; 13 | element.style.visibility = value ? Visibility.Visible : Visibility.Hidden; 14 | } 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Common/UIUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 06dbbe23cad5640899940581f6f5ab8c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/Common/VisualElementExtensions.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UIElements; 2 | 3 | namespace UnityEditor.ImmediateWindow.UI 4 | { 5 | internal static class VisualElementExtensions 6 | { 7 | public static void EnableClass(this VisualElement element, string classname, bool enable) 8 | { 9 | element.RemoveFromClassList(classname); 10 | 11 | if (enable) 12 | element.AddToClassList(classname); 13 | } 14 | 15 | /// 16 | /// Utility method when toggling between two classes based on boolean 17 | /// 18 | /// Extension element 19 | /// Class to set if enabled 20 | /// Class to set if disabled 21 | /// State to set classes from 22 | public static void EnableClassToggle(this VisualElement element, string classnameA, string classnameB, bool enable) 23 | { 24 | element.RemoveFromClassList(classnameA); 25 | element.RemoveFromClassList(classnameB); 26 | 27 | if (enable) 28 | element.AddToClassList(classnameA); 29 | else 30 | element.AddToClassList(classnameB); 31 | } 32 | 33 | /// 34 | /// Utility method to add multiple classes at once 35 | /// 36 | /// Extension element 37 | /// Space-separated list of classes to add 38 | public static void AddClasses(this VisualElement element, string classnames) 39 | { 40 | if (!string.IsNullOrEmpty(classnames)) 41 | foreach (var classname in classnames.Split(' ')) 42 | element.AddToClassList(classname); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/Common/VisualElementExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33632f848ffbf4b5288a6e66acad8989 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/External.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2f6b27c1d6c4466eaff1d0c544c254b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/Services/External/ParsedAssemblyQualifiedName.cs: -------------------------------------------------------------------------------- 1 |  2 | // Copyright Christophe Bertrand. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Reflection; 8 | using System.Text; 9 | 10 | namespace ParsedAssemblyQualifiedName 11 | { 12 | internal class ParsedAssemblyQualifiedName 13 | { 14 | public Lazy AssemblyNameDescriptor; 15 | public Lazy FoundType; 16 | public readonly string AssemblyDescriptionString; 17 | public readonly string TypeName; 18 | public readonly string ShortAssemblyName; 19 | public readonly string Version; 20 | public readonly string Culture; 21 | public readonly string PublicKeyToken; 22 | public readonly List GenericParameters = new List(); 23 | public readonly Lazy CSharpStyleName; 24 | public readonly Lazy VBNetStyleName; 25 | public bool UseShortTypeName; 26 | 27 | public ParsedAssemblyQualifiedName(string AssemblyQualifiedName, bool useShortTypeName = false) 28 | { 29 | UseShortTypeName = useShortTypeName; 30 | int index = -1; 31 | block rootBlock = new block(); 32 | { 33 | int bcount = 0; 34 | block currentBlock = rootBlock; 35 | for (int i = 0; i < AssemblyQualifiedName.Length; ++i) 36 | { 37 | char c = AssemblyQualifiedName[i]; 38 | if (c == '[') 39 | { 40 | if (AssemblyQualifiedName[i + 1] == ']') // Array type. 41 | i++; 42 | else 43 | { 44 | ++bcount; 45 | var b = new block() { iStart = i + 1, level = bcount, parentBlock = currentBlock }; 46 | currentBlock.innerBlocks.Add(b); 47 | currentBlock = b; 48 | } 49 | } 50 | else if (c == ']') 51 | { 52 | currentBlock.iEnd = i - 1; 53 | if (AssemblyQualifiedName[currentBlock.iStart] != '[') 54 | { 55 | currentBlock.parsedAssemblyQualifiedName = new ParsedAssemblyQualifiedName(AssemblyQualifiedName.Substring(currentBlock.iStart, i - currentBlock.iStart), UseShortTypeName); 56 | if (bcount == 2) 57 | this.GenericParameters.Add(currentBlock.parsedAssemblyQualifiedName); 58 | } 59 | currentBlock = currentBlock.parentBlock; 60 | --bcount; 61 | } 62 | else if (bcount == 0 && c == ',') 63 | { 64 | index = i; 65 | break; 66 | } 67 | } 68 | } 69 | 70 | this.TypeName = AssemblyQualifiedName.Substring(0, index); 71 | 72 | this.CSharpStyleName = new Lazy( 73 | () => 74 | { 75 | return this.LanguageStyle("<", ">"); 76 | }); 77 | 78 | this.VBNetStyleName = new Lazy( 79 | () => 80 | { 81 | return this.LanguageStyle("(Of ", ")"); 82 | }); 83 | 84 | this.AssemblyDescriptionString = AssemblyQualifiedName.Substring(index + 2); 85 | 86 | { 87 | List parts = AssemblyDescriptionString.Split(',') 88 | .Select(x => x.Trim()) 89 | .ToList(); 90 | this.Version = LookForPairThenRemove(parts, "Version"); 91 | this.Culture = LookForPairThenRemove(parts, "Culture"); 92 | this.PublicKeyToken = LookForPairThenRemove(parts, "PublicKeyToken"); 93 | if (parts.Count > 0) 94 | this.ShortAssemblyName = parts[0]; 95 | } 96 | 97 | this.AssemblyNameDescriptor = new Lazy( 98 | () => new System.Reflection.AssemblyName(this.AssemblyDescriptionString)); 99 | 100 | this.FoundType = new Lazy( 101 | () => 102 | { 103 | var searchedType = Type.GetType(AssemblyQualifiedName); 104 | if (searchedType != null) 105 | return searchedType; 106 | foreach (var assem in Assemblies.Value) 107 | { 108 | searchedType = 109 | assem.GetType(AssemblyQualifiedName); 110 | if (searchedType != null) 111 | return searchedType; 112 | } 113 | return null; // Not found. 114 | }); 115 | } 116 | 117 | internal static string ShortTypeName(string typeName) 118 | { 119 | return typeName.IndexOf('.') > 0 ? typeName.Split('.').Last() : typeName; 120 | } 121 | 122 | internal string GetTypeName() 123 | { 124 | return UseShortTypeName ? ShortTypeName(TypeName) : TypeName; 125 | } 126 | 127 | internal string LanguageStyle(string prefix, string suffix) 128 | { 129 | var typeName = GetTypeName(); 130 | if (this.GenericParameters.Count > 0) 131 | { 132 | var typeNameString = TypeName.Substring(0, TypeName.IndexOf('`')); 133 | if (UseShortTypeName) 134 | typeNameString = ShortTypeName(typeNameString); 135 | 136 | StringBuilder sb = new StringBuilder(typeNameString); 137 | sb.Append(prefix); 138 | bool pendingElement = false; 139 | foreach (var param in this.GenericParameters) 140 | { 141 | if (pendingElement) 142 | sb.Append(", "); 143 | sb.Append(param.LanguageStyle(prefix,suffix)); 144 | pendingElement = true; 145 | } 146 | sb.Append(suffix); 147 | return sb.ToString(); 148 | } 149 | else 150 | return typeName; 151 | } 152 | class block 153 | { 154 | internal int iStart; 155 | internal int iEnd; 156 | internal int level; 157 | internal block parentBlock; 158 | internal List innerBlocks = new List(); 159 | internal ParsedAssemblyQualifiedName parsedAssemblyQualifiedName; 160 | } 161 | 162 | static string LookForPairThenRemove(List strings, string Name) 163 | { 164 | for (int istr = 0; istr < strings.Count; istr++) 165 | { 166 | string s = strings[istr]; 167 | int i = s.IndexOf(Name); 168 | if (i == 0) 169 | { 170 | int i2 = s.IndexOf('='); 171 | if (i2 > 0) 172 | { 173 | string ret = s.Substring(i2 + 1); 174 | strings.RemoveAt(istr); 175 | return ret; 176 | } 177 | } 178 | } 179 | return null; 180 | } 181 | 182 | static readonly Lazy Assemblies = 183 | new Lazy(() => 184 | AppDomain.CurrentDomain.GetAssemblies()); 185 | 186 | #if DEBUG 187 | // Makes debugging easier. 188 | public override string ToString() 189 | { 190 | return this.CSharpStyleName.ToString(); 191 | } 192 | #endif 193 | } 194 | 195 | 196 | 197 | } 198 | -------------------------------------------------------------------------------- /Editor/Sources/Services/External/ParsedAssemblyQualifiedName.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f7d30424179a42f29927d87653145b7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/QuickInspector.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7751d074bb5f44a19324402ad58c22d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/Services/QuickInspector/ATypeView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | /// 7 | /// Common ITypeView Implementation 8 | /// 9 | public abstract class ATypeView : ITypeView 10 | { 11 | public string Name => GetType().Name; 12 | public virtual double Priority {get { return 0; }} 13 | 14 | public virtual bool HasView(Type type) {return false;} 15 | public virtual VisualElement GetView(object obj, ViewContext context) {return new VisualElement();} 16 | } 17 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/QuickInspector/ATypeView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b991b4c31ae2452bb50579371054b9c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/QuickInspector/ITypeView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | public interface ITypeView 7 | { 8 | string Name { get; } // Name to be used in the interface 9 | double Priority { get; } // Priority of this type view over others 10 | 11 | bool HasView(Type type); 12 | VisualElement GetView(object obj, ViewContext context); 13 | } 14 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/QuickInspector/ITypeView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b453b84ddd7b942f29ad7a4ae1bba660 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/QuickInspector/TypeViewFinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEditor.ImmediateWindow.Services; 5 | 6 | namespace UnityEditor.ImmediateWindow.UI 7 | { 8 | internal class TypeRouter 9 | { 10 | private static TypeRouter instance = new TypeRouter(); 11 | public static TypeRouter Instance { get { return instance; } } 12 | 13 | 14 | private List _TypeViewers; 15 | private IEnumerable TypeViewers 16 | { 17 | get 18 | { 19 | if (_TypeViewers == null) 20 | { 21 | _TypeViewers = new List(); 22 | 23 | var types = Inspector.GetTypesWithInterface(typeof(ITypeView)).Where(t => t.IsClass && !t.IsAbstract); 24 | foreach (var type in types) 25 | _TypeViewers.Add((ITypeView)Activator.CreateInstance(type)); 26 | } 27 | 28 | return _TypeViewers; 29 | } 30 | } 31 | 32 | // Get all types that can provide a view for the given type 33 | public IEnumerable GetTypeViewer(Type type) 34 | { 35 | var typeviews = new List(); 36 | foreach (var typeviewer in TypeViewers) 37 | { 38 | if (typeviewer.HasView(type)) 39 | typeviews.Add(typeviewer); 40 | } 41 | 42 | return typeviews; 43 | } 44 | 45 | public IEnumerable GetTypeViewer(object obj) 46 | { 47 | return GetTypeViewer(obj?.GetType()); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/QuickInspector/TypeViewFinder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 374b70e7ae4e04ff9ac5b6bfa9d23b62 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/QuickInspector/ViewContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | public class ViewContext 7 | { 8 | public event Action OnTypeSwitch = delegate { }; 9 | 10 | public ViewMode Mode = ViewMode.Default; 11 | public object Data = null; // Arbitrary data typeviews can use 12 | public IEnumerable Viewers; // Viewers for this object (order in ascending priority) 13 | public ITypeView Viewer; // View to use in this context 14 | 15 | public void SwitchType(ITypeView viewer) 16 | { 17 | Viewer = viewer; 18 | OnTypeSwitch(Viewer); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/QuickInspector/ViewContext.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 558ffe146a07d43bc93b15f90267ccdb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/QuickInspector/ViewMode.cs: -------------------------------------------------------------------------------- 1 | namespace UnityEditor.ImmediateWindow.UI 2 | { 3 | public enum ViewMode 4 | { 5 | Default, // Default view (eg: Expandable with arrow for objects) 6 | 7 | Value, // View shown when object is displayed as a value in a collapsed state (should be the shortest possible view to save space) 8 | 9 | Collapsed, // View shown when object is collapsed 10 | Expanded // View shown when object is expanded 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Editor/Sources/Services/QuickInspector/ViewMode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de6806f79549d4f77a397fa59cd5c585 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/State.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 152a7b22a1db043a98c5a6f6a33a1423 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/Services/State/Command.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UnityEditor.ImmediateWindow.Services 4 | { 5 | [Serializable] 6 | internal class Command 7 | { 8 | public int index; 9 | public string code; 10 | } 11 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/State/Command.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 45c4f9d52e7b0489aa7f5fd8ca51716d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/State/History.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace UnityEditor.ImmediateWindow.Services 6 | { 7 | [Serializable] 8 | internal class History 9 | { 10 | // Disabled until it can be made to work properly 11 | //private static int MaxHistory = 50; 12 | 13 | private static History instance = new History(); 14 | public static History Instance { get { return instance; } } 15 | 16 | protected List Commands 17 | { 18 | get { return State.Instance.Commands; } 19 | } 20 | 21 | public History() 22 | { 23 | } 24 | 25 | public Command AddCommand(string code) 26 | { 27 | Command result = null; 28 | if (!string.IsNullOrEmpty(code)) 29 | { 30 | var previousIsSame = Commands.Any() && Commands.Last().code == code; 31 | if (!previousIsSame) 32 | { 33 | result = new Command {code = code, index = Commands.Count}; 34 | Commands.Add(result); 35 | 36 | // TODO: Cannot crop the list since it makes all indexes change. Index is probably awful way of doing it anyway.. 37 | // Commands = TakeLast(Commands, MaxHistory).ToList(); 38 | } 39 | } 40 | 41 | return result; 42 | } 43 | 44 | // Return the previous command relative to given command 45 | public Command PreviousCommand(Command command = null) 46 | { 47 | if (command == null) 48 | return Commands.LastOrDefault(); 49 | 50 | var index = Math.Min(command.index, Commands.Count - 1); // Make sure index doesn't go out of range 51 | if (index != 0) 52 | return Commands.ElementAt(index - 1); 53 | 54 | return command; 55 | } 56 | 57 | // Return the next command relative to given command 58 | public Command NextCommand(Command command = null) 59 | { 60 | if (command == null) 61 | return null; 62 | 63 | if (command.index < (Commands.Count - 1)) 64 | return Commands.ElementAt(command.index + 1); 65 | 66 | return null; 67 | } 68 | 69 | public void Clear() 70 | { 71 | Commands.Clear(); 72 | } 73 | 74 | public static IEnumerable TakeLast(IEnumerable coll, int N) 75 | { 76 | return coll.Reverse().Take(N).Reverse(); 77 | } 78 | } 79 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/State/History.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd1d616109a35498eb3509e3064a62f9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/Services/State/State.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace UnityEditor.ImmediateWindow.Services 5 | { 6 | [Serializable] 7 | internal class State 8 | { 9 | private static State instance = new State(); 10 | public static State Instance { get { return instance; } } 11 | 12 | public List Commands = new List(); 13 | public string ScriptCode; 14 | public bool ShowPrivate = true; 15 | public bool MultiLineMode; 16 | public bool ShowContext = true; 17 | public List Namespaces = new List(); 18 | 19 | public static void Init(ref State value) 20 | { 21 | if (value == null) // UI window opened 22 | { 23 | value = instance; 24 | } 25 | else // Domain reload 26 | { 27 | instance = value; 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Editor/Sources/Services/State/State.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0edc7fa56cfa5478d83227511d975f51 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ebb925653017460093b66356e655bf7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Common.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 763638a63313d459f832f63c3bcd7bf9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/Arrow.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UIElements; 2 | 3 | namespace UnityEditor.ImmediateWindow.UI 4 | { 5 | internal class Arrow : TextElement 6 | { 7 | public enum Direction 8 | { 9 | Left, 10 | Right, 11 | Up, 12 | Down 13 | } 14 | 15 | public Arrow(Direction direction = Direction.Right, string defaultClass = "arrow") 16 | { 17 | AddToClassList(defaultClass); 18 | SetDirection(direction); 19 | } 20 | 21 | public void SetDirection(Direction direction) 22 | { 23 | if (direction == Direction.Left) 24 | text = "◄"; 25 | else if (direction == Direction.Right) 26 | text = "►"; 27 | else if (direction == Direction.Up) 28 | text = "▲"; 29 | else if (direction == Direction.Down) 30 | text = "▼"; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/Arrow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9c4eb15e2d1314bfea4eea905825fb78 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/ArrowToggle.cs: -------------------------------------------------------------------------------- 1 | namespace UnityEditor.ImmediateWindow.UI 2 | { 3 | internal class ArrowToggle : Arrow 4 | { 5 | private bool _Expanded; 6 | public bool Expanded 7 | { 8 | get { return _Expanded; } 9 | set 10 | { 11 | _Expanded = value; 12 | 13 | this.EnableClassToggle("expanded", "collapsed", Expanded); 14 | 15 | if (_Expanded) 16 | SetDirection(Direction.Down); 17 | else 18 | SetDirection(Direction.Right); 19 | } 20 | } 21 | 22 | public ArrowToggle() 23 | { 24 | Expanded = false; 25 | } 26 | 27 | public void Toggle() 28 | { 29 | Expanded = !Expanded; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/ArrowToggle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c7750bb7fcd84d49ac603aa16b15367 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/Container.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UIElements; 2 | 3 | namespace UnityEditor.ImmediateWindow.UI 4 | { 5 | internal class Container : VisualElement 6 | { 7 | public Container(string classnames = "container") 8 | { 9 | this.AddClasses(classnames); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/Container.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da5b10e061d804168a765a649c1abb55 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/Expandable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | internal class Expandable : VisualElement 7 | { 8 | public event Action OnExpandStateChanged = delegate { }; 9 | 10 | public bool Expanded 11 | { 12 | get { return Arrow.Expanded; } 13 | set 14 | { 15 | this.EnableClassToggle("expanded", "collapsed", value); 16 | 17 | Arrow.Expanded = value; 18 | 19 | if (value) 20 | Add(ExpandedGroup); 21 | else 22 | if (Contains(ExpandedGroup)) 23 | Remove(ExpandedGroup); 24 | 25 | OnExpandStateChanged(value); 26 | } 27 | } 28 | 29 | protected ArrowToggle Arrow { get; set; } 30 | protected VisualElement Content { get; set; } 31 | public VisualElement CollapsedGroup { get; protected set; } 32 | public VisualElement ExpandedGroup { get; protected set; } 33 | 34 | public Expandable(bool expanded = false) 35 | { 36 | AddToClassList("expandable"); 37 | 38 | Arrow = new ArrowToggle(); 39 | 40 | Content = new Container("collapseRow"); 41 | Add(Content); 42 | 43 | CollapsedGroup = new Container("collapsedGroup"); 44 | CollapsedGroup.RegisterCallback(OnClick); 45 | CollapsedGroup.Add(Arrow); 46 | Content.Add(CollapsedGroup); 47 | 48 | ExpandedGroup = new Container("expandedGroup"); 49 | Add(ExpandedGroup); 50 | 51 | Expanded = expanded; 52 | } 53 | 54 | protected void OnClick(MouseDownEvent evt) 55 | { 56 | Toggle(); 57 | } 58 | 59 | public void Toggle() 60 | { 61 | Expanded = !Expanded; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/Expandable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7157ea161fab44e7a90d8fa3eec020ef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/ExtendedExpandable.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | /// 7 | /// Visual Structure 8 | /// 9 | /// Content 10 | /// |-----------------------------------------------------| 11 | /// CollapsedGroup 12 | /// |---------------------------------| 13 | /// CollapseViewContainer 14 | /// |----------------| 15 | /// Label CollapseView Tools 16 | /// |-------------|----------------|--------------------| 17 | /// ► MyClass {desc} Tools 18 | /// 19 | /// 20 | internal class ExtendedExpandable : Expandable 21 | { 22 | // Permanent label (optional) 23 | private Span _Label; 24 | public Span Label 25 | { 26 | get { return _Label;} 27 | set 28 | { 29 | if (Label != null) 30 | CollapsedGroup.Remove(Label); 31 | 32 | _Label = value; 33 | 34 | if (Label != null) 35 | { 36 | Label.AddToClassList("label"); 37 | CollapsedGroup.Insert(1, Label); // Index 1 = after arrow 38 | } 39 | } 40 | } 41 | 42 | public VisualElement CollapseViewContainer { get; protected set; } // Container is there so content can be added/removed easily 43 | 44 | private VisualElement _CollapsedView; 45 | public VisualElement CollapsedView 46 | { 47 | get { return _CollapsedView;} 48 | set 49 | { 50 | _CollapsedView = value; 51 | 52 | SetCollapseView(); 53 | } 54 | } 55 | 56 | private VisualElement _ExpandedView; 57 | public VisualElement ExpandedView 58 | { 59 | get { return _ExpandedView;} 60 | set 61 | { 62 | _ExpandedView = value; 63 | 64 | ExpandedGroup.Clear(); 65 | ExpandedGroup.Add(ExpandedView); 66 | } 67 | } 68 | 69 | private VisualElement _Tools; 70 | public VisualElement Tools 71 | { 72 | get 73 | { 74 | // Only Create a Tools element if it is needed 75 | if (_Tools == null) 76 | { 77 | _Tools = new Container("tools"); 78 | Content.Add(Tools); 79 | } 80 | 81 | return _Tools; 82 | } 83 | } 84 | 85 | public ExtendedExpandable() 86 | { 87 | Label = new Span(); 88 | 89 | CollapseViewContainer = new Container("collapseView"); 90 | CollapsedGroup.Add(CollapseViewContainer); 91 | CollapsedView = new VisualElement(); 92 | 93 | OnExpandStateChanged += OnExpandState; 94 | } 95 | 96 | public ExtendedExpandable(string label = "", VisualElement expandedView = null, VisualElement collapsedView = null, bool expanded = false, string classnames = "", 97 | string labelClassNames = "") : this() 98 | { 99 | this.AddClasses(classnames); 100 | Label.AddClasses(labelClassNames); 101 | 102 | Label.text = label; 103 | if (expandedView != null) 104 | ExpandedView = expandedView; 105 | 106 | if (collapsedView!= null) 107 | CollapsedView = collapsedView; 108 | 109 | Expanded = expanded; 110 | } 111 | 112 | private void SetCollapseView() 113 | { 114 | CollapseViewContainer.Clear(); 115 | CollapseViewContainer.Add(CollapsedView); 116 | } 117 | 118 | 119 | private void OnExpandState(bool expanded) 120 | { 121 | if (expanded) 122 | CollapseViewContainer.Remove(CollapsedView); 123 | else 124 | CollapseViewContainer.Add(CollapsedView); 125 | } 126 | } 127 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/ExtendedExpandable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d9287c352f41476a866f2da8f9a9779 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/Span.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UIElements; 2 | 3 | namespace UnityEditor.ImmediateWindow.UI 4 | { 5 | /// 6 | /// Shortcut to create inline VisualElements 7 | /// 8 | public class Span : TextElement 9 | { 10 | /// 11 | /// Basic span creation 12 | /// 13 | public Span() 14 | { 15 | AddToClassList("span"); 16 | } 17 | 18 | /// 19 | /// Span creation 20 | /// 21 | /// Text to set your inline element to 22 | /// Whitespace-separated list of classes to add 23 | /// Tooltip text 24 | public Span(string text, string classnames = "", string tooltip = "") : this() 25 | { 26 | Init(text, classnames, tooltip); 27 | } 28 | 29 | internal void Init(string text, string classnames = "", string tooltip = "") 30 | { 31 | this.text = text; 32 | 33 | if (!string.IsNullOrEmpty(tooltip)) 34 | this.tooltip = tooltip; 35 | 36 | this.AddClasses(classnames); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/Span.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b743809dc9d1b4ee294bacc113308878 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/Text.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | // Text field that can be selected but not modified 7 | // For some odd reason, if it inhertis from TextField, selection doesn't work 8 | internal class Text : TextField 9 | { 10 | 11 | public static TextField Create(string text = null, bool asSpan = true, string classnames = "") 12 | { 13 | var field = new TextField(); 14 | if (!string.IsNullOrEmpty(text)) 15 | field.value = text; 16 | 17 | field.AddToClassList("text"); 18 | field.AddClasses(classnames); 19 | 20 | if (asSpan) 21 | field.AddToClassList("span"); 22 | 23 | field.RegisterCallback(evt => 24 | { 25 | // Don't allow modification of this textfield 26 | evt.PreventDefault(); 27 | evt.StopImmediatePropagation(); 28 | }); 29 | 30 | return field; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/Common/Text.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 387132190877e48c4a83c443f94950c8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1e34b08e35d4415099cc78350fbb867 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/QuickInspector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.UIElements; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | /** 8 | * Displays most generic object (will decide what is the proper display type should be) 9 | */ 10 | public class QuickInspector : VisualElement 11 | { 12 | private object Obj { get; set; } 13 | 14 | public QuickInspector() 15 | { 16 | Init(); 17 | } 18 | 19 | public QuickInspector(object obj) 20 | { 21 | Init(); 22 | SetObject(obj); 23 | } 24 | 25 | void Init() 26 | { 27 | AddToClassList("quickInspector"); 28 | } 29 | 30 | public void SetObject(object obj) 31 | { 32 | try 33 | { 34 | Obj = obj; 35 | Add(new TypeInspector(obj, new ViewContext())); 36 | } 37 | catch (Exception e) 38 | { 39 | Debug.LogError("Error with quick inspector: " + e.Message + "\n\n" + e.StackTrace); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/QuickInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 440d05f101d9e4b4a8ced3be6717aca7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TestObjects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea5464ea0babd4d1fae25e3bab763923 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TestObjects/Objects.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEditor.ImmediateWindow.UI; 4 | 5 | namespace UnityEditor.ImmediateWindow.TestObjects 6 | { 7 | internal class SecretStruct 8 | { 9 | static public SimpleObject SomeStaticObject = new SimpleObject() {a = 100, x = "some string"}; 10 | static public bool SomeStaticValue = false; 11 | static public string SomeStaticPropertyValue 12 | { 13 | get { return "yessir!!!";} 14 | } 15 | 16 | public int BestValue = 1978; 17 | } 18 | } 19 | 20 | namespace UnityEditor.ImmediateWindow.UI 21 | { 22 | internal class SimpleObject 23 | { 24 | public int a; 25 | public string x; 26 | private float y; 27 | 28 | public float TestFunction(int x) 29 | { 30 | return y * x; 31 | } 32 | 33 | public static SimpleObject Create() 34 | { 35 | var obj = new SimpleObject(); 36 | 37 | obj.a = 12; 38 | obj.x = "my string"; 39 | obj.y = 100.999f; 40 | 41 | return obj; 42 | } 43 | } 44 | 45 | internal class InheritedObject 46 | { 47 | public int[] InheritedField = new int[] {4, 5, 6}; 48 | public string InheritedProperty { get; } = "yes"; 49 | 50 | public void InheritedMethod() {} 51 | } 52 | 53 | internal class ComplexObject : InheritedObject 54 | { 55 | public int myOhMy; 56 | public SimpleObject Simple; 57 | public object Loop; 58 | public int[] Numbers = new int[] {4, 5, 6}; 59 | public string[] Strings = new string[] {"yes", "works!"}; 60 | public IEnumerable StringsEnum = new List {"yes enum", "works enum!"}; 61 | public object ObjectArray = new object[] {"yes enum", "works enum!", 123, SimpleObject.Create()}; 62 | public Dictionary SimpleDict = new Dictionary { {"key1", 100}, {"key2", 200}}; 63 | 64 | static public bool HasLooped = false; 65 | 66 | public static ComplexObject Create() 67 | { 68 | var obj = new ComplexObject(); 69 | obj.Simple = SimpleObject.Create(); 70 | obj.myOhMy = 123456; 71 | if (!HasLooped) 72 | { 73 | obj.Loop = new ComplexObject(); 74 | HasLooped = true; 75 | } 76 | 77 | // Silence warning for obj.y not used 78 | var tmp = new SimpleObject(); 79 | if (tmp.a < (new Random()).Next()) 80 | tmp.TestFunction(10); 81 | 82 | return obj; 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TestObjects/Objects.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e35d8316543df4faaae1d2db49f5d2a2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeInspector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Linq; 4 | using UnityEngine; 5 | using UnityEngine.UIElements; 6 | 7 | namespace UnityEditor.ImmediateWindow.UI 8 | { 9 | /// 10 | /// Basic inspector view for any type. This will use the type finder mechanism which searches for all 11 | /// classes implementing ITypeView, and will provide the correct view for those types. 12 | /// 13 | public class TypeInspector : VisualElement 14 | { 15 | /// 16 | /// Constructor for typeview. 17 | /// 18 | /// Object to view 19 | /// 20 | public TypeInspector(object obj, ViewContext context) 21 | { 22 | AddToClassList("typeInspector"); 23 | SetObject(obj, context); 24 | } 25 | 26 | internal void SetObject(object obj, ViewContext context) 27 | { 28 | if (context.Viewer == null) 29 | { 30 | var viewers = TypeRouter.Instance.GetTypeViewer(obj).OrderBy(t => t.Priority); 31 | if (viewers.Any()) 32 | { 33 | context.Viewers = viewers; 34 | context.Viewer = viewers.Last(); 35 | } 36 | else 37 | { 38 | throw new Exception("No type viewer found for object (should never happen)."); 39 | } 40 | } 41 | 42 | if (context.Viewer == null) 43 | { 44 | Debug.LogWarning("No context viewer found for type inspector."); 45 | return; 46 | } 47 | 48 | 49 | Add(context.Viewer.GetView(obj, context)); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b01b27e632e946ea8d05478277a6aa5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 970e67eeaa7a94d92b4819fd1b551a67 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/ArrayType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEngine.UIElements; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | internal class ArrayType : ATypeView 8 | { 9 | public override bool HasView(Type type) 10 | { 11 | if (type == null) return false; 12 | 13 | return type.IsArray; 14 | } 15 | 16 | public override VisualElement GetView(object obj, ViewContext context) 17 | { 18 | if (context.Mode == ViewMode.Default) 19 | return new ExpandableObject(obj, context); 20 | 21 | if (context.Mode == ViewMode.Collapsed) 22 | return new CollapsedArrayGroup(obj as IEnumerable); 23 | if (context.Mode == ViewMode.Expanded) 24 | return new ExpandedArrayGroup(obj); 25 | if (context.Mode == ViewMode.Value) 26 | return new TypeNameView(obj); 27 | 28 | throw new Exception("Should not get here"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/ArrayType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 845c2f1f26a0b4c41a7dd533c5784ba8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/ComplexObjectType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Numerics; 3 | using UnityEngine.UIElements; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | // For debugging multi-views only 8 | internal class ComplexObjectType1 : ITypeView 9 | { 10 | public string Name { get; } = "Complex 1"; 11 | public virtual double Priority {get { return -2; }} 12 | 13 | public bool HasView(Type type) 14 | { 15 | if (type == null) return false; 16 | 17 | return type == typeof(ComplexObject); 18 | } 19 | 20 | public VisualElement GetView(object obj, ViewContext context) 21 | { 22 | return new NullType().GetView(obj, context); 23 | } 24 | } 25 | 26 | // For debugging multi-views only 27 | internal class ComplexObjectType2 : ITypeView 28 | { 29 | public string Name { get; } = "Complex 2"; 30 | public virtual double Priority {get { return -3; }} 31 | 32 | public bool HasView(Type type) 33 | { 34 | if (type == null) return false; 35 | 36 | return type == typeof(ComplexObject); 37 | } 38 | 39 | public VisualElement GetView(object obj, ViewContext context) 40 | { 41 | return new StringType().GetView(obj, context); 42 | } 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/ComplexObjectType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6fdbd65d4351444b79efc0038bf8728c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/DictionaryType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using UnityEngine; 6 | using UnityEngine.UIElements; 7 | 8 | namespace UnityEditor.ImmediateWindow.UI 9 | { 10 | internal class DictionaryType : ITypeView 11 | { 12 | public string Name { get; } = "Dictionary"; 13 | 14 | // Slightly higher then Array/IEnumerable 15 | public virtual double Priority {get { return 0.1; }} 16 | 17 | public bool HasView(Type type) 18 | { 19 | if (type == null) return false; 20 | 21 | return typeof(IDictionary).IsAssignableFrom(type); 22 | } 23 | 24 | public VisualElement GetView(object obj, ViewContext context) 25 | { 26 | if (context.Mode == ViewMode.Default) 27 | return new ExpandableObject(obj, context); 28 | 29 | if (context.Mode == ViewMode.Collapsed) 30 | return new CollapsedDictionaryGroup(obj as IDictionary); 31 | if (context.Mode == ViewMode.Expanded) 32 | return new ExpandedDictionaryGroup(obj as IDictionary); 33 | if (context.Mode == ViewMode.Value) 34 | return new TypeNameView(obj); 35 | 36 | throw new Exception("Should not get here"); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/DictionaryType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1708519b4f80452bbe743124ceb6bff 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2a98c0072dfa44da59cb15b46ec85998 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/CachedView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | internal class CachedView 7 | { 8 | private Func ViewFactory { get; set; } 9 | 10 | private VisualElement _View; 11 | public VisualElement View 12 | { 13 | get 14 | { 15 | if (_View == null) 16 | _View = ViewFactory(); 17 | 18 | return _View; 19 | } 20 | } 21 | 22 | public CachedView(Func viewFactory) 23 | { 24 | ViewFactory = viewFactory; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/CachedView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c850a056fccb8484cb7a494c2c1483e7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/CollapsedArrayGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Linq; 3 | using UnityEngine.UIElements; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | public class CollapsedArrayGroup : VisualElement 8 | { 9 | public CollapsedArrayGroup(IEnumerable obj) 10 | { 11 | AddToClassList("collapsedArrayGroup"); 12 | 13 | Add(new Span("[")); 14 | 15 | var objects = obj.Cast().ToArray(); 16 | 17 | bool isClipped = objects.Length > Config.ShowMaxCollapsedArrayItems; 18 | var items = objects.Take(Config.ShowMaxCollapsedArrayItems).ToList(); 19 | 20 | int i = 0; 21 | foreach (var item in items) 22 | { 23 | if (i != 0) 24 | Add(new Span(", ")); 25 | 26 | var fieldValue = new TypeInspector(item, new ViewContext {Mode = ViewMode.Value}); 27 | Add(fieldValue); 28 | i++; 29 | } 30 | 31 | if (isClipped) 32 | { 33 | var expander = new Span(", (...)"); 34 | Add(expander); 35 | } 36 | 37 | Add(new Span("]")); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/CollapsedArrayGroup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72acd72396eec4f56856a3783d04f07f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/CollapsedDictionaryGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Linq; 3 | using UnityEngine.UIElements; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | internal class CollapsedDictionaryGroup : VisualElement 8 | { 9 | public CollapsedDictionaryGroup(IDictionary obj) 10 | { 11 | AddToClassList("collapsedArrayGroup"); 12 | 13 | Add(new Span("{")); 14 | 15 | int i = 0; 16 | foreach (var key in obj.Keys) 17 | { 18 | if (i > Config.ShowMaxCollapsedArrayItems) 19 | break; 20 | if (i != 0) 21 | Add(new Span(", ")); 22 | 23 | var container = new Container("propertyValueGroup"); 24 | var propertyValue = new TypeInspector(key, new ViewContext {Mode = ViewMode.Value}); 25 | container.Add(propertyValue); 26 | container.Add(new Span(": ")); 27 | var fieldValue = new TypeInspector(obj[key], new ViewContext {Mode = ViewMode.Value}); 28 | container.Add(fieldValue); 29 | 30 | Add(container); 31 | 32 | i++; 33 | } 34 | 35 | if (i > Config.ShowMaxCollapsedArrayItems) 36 | { 37 | var expander = new Span(", (...)"); 38 | Add(expander); 39 | } 40 | 41 | Add(new Span("}")); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/CollapsedDictionaryGroup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 783beb0e63e9848b0851c7aaa6fedd31 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/CollapsedPropertyGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | public class CollapsedPropertyGroup : VisualElement 7 | { 8 | public CollapsedPropertyGroup(object obj) 9 | { 10 | AddToClassList("collapsedPropertyGroup"); 11 | 12 | Add(new Span("{")); 13 | 14 | var properties = PropertyUtils.GetPropertyInfo(obj).ToList(); 15 | bool isClipped = properties.Count > Config.ShowMaxCollapsedProperties; 16 | properties = properties.Take(Config.ShowMaxCollapsedProperties).ToList(); 17 | 18 | int i = 0; 19 | foreach (var property in properties) 20 | { 21 | if (i != 0) 22 | Add(new Span(", ")); 23 | 24 | Add(new PropertyValueGroup(property, new ViewContext {Mode = ViewMode.Value})); 25 | i++; 26 | } 27 | 28 | if (isClipped) 29 | { 30 | var expander = new Span(", (...)"); 31 | Add(expander); 32 | } 33 | 34 | Add(new Span("}")); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/CollapsedPropertyGroup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4df6a96fe012428696baee6f6ced521 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandableObject.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.ComponentModel; 3 | using UnityEditor.ImmediateWindow.Services; 4 | using UnityEngine.UIElements; 5 | 6 | namespace UnityEditor.ImmediateWindow.UI 7 | { 8 | public class ExpandableObject : VisualElement 9 | { 10 | private ExtendedExpandable Content { get; set; } 11 | 12 | private object CurrentObject { get; set; } 13 | private ViewContext Context { get; set; } 14 | private CachedView ExpandedView { get; set; } 15 | private CachedView CollapsedView { get; set; } 16 | 17 | public ExpandableObject(object obj, ViewContext context) 18 | { 19 | CurrentObject = obj; 20 | Context = context; 21 | ExpandedView = new CachedView(() => new TypeInspector(obj, new ViewContext {Mode = ViewMode.Expanded})); 22 | CollapsedView = new CachedView(() => new TypeInspector(obj, new ViewContext {Mode = ViewMode.Collapsed})); 23 | 24 | var views = new Container("viewModes"); 25 | var typeViewSelection = new TypeViewSelection(obj, context); 26 | context.OnTypeSwitch += OnTypeSwitch; 27 | views.Add(typeViewSelection); 28 | 29 | Content = new ExtendedExpandable(); 30 | Content.Tools.Add(views); 31 | Content.Label = new TypeNameView(CurrentObject); 32 | Content.OnExpandStateChanged += expanded => Refresh(); 33 | Add(Content); 34 | 35 | Refresh(); 36 | } 37 | 38 | private void OnTypeSwitch(ITypeView viewer) 39 | { 40 | ExpandedView = new CachedView(() => new TypeInspector(CurrentObject, new ViewContext {Mode = ViewMode.Expanded, Viewer = viewer})); 41 | CollapsedView = new CachedView(() => new TypeInspector(CurrentObject, new ViewContext {Mode = ViewMode.Collapsed, Viewer = viewer})); 42 | 43 | Refresh(); // Rebuild with new forced type 44 | } 45 | 46 | private void Refresh() 47 | { 48 | // Prevent infinite recursion by only creating expanded element on demande 49 | // (since properties can be self-referential) 50 | if (Content.Expanded) 51 | { 52 | Content.CollapsedView = new VisualElement(); 53 | Content.ExpandedView = ExpandedView.View; 54 | } 55 | else 56 | { 57 | Content.ExpandedView = new VisualElement(); 58 | Content.CollapsedView = CollapsedView.View; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandableObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18a952c3599df45f1a564ba89979a3e4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandedArrayGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Linq; 3 | using UnityEngine.UIElements; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | public class ExpandedArrayGroup : VisualElement 8 | { 9 | public ExpandedArrayGroup(object obj) 10 | { 11 | AddToClassList("expandedArrayGroup"); 12 | 13 | var objects = ((IEnumerable) obj).Cast().ToArray(); 14 | 15 | bool isClipped = objects.Length > Config.ShowMaxArrayProperties; 16 | var items = objects.Take(Config.ShowMaxBlockProperties).ToList(); 17 | 18 | var i = 0; 19 | foreach (var item in items) 20 | { 21 | var propertyLabel = new ProperyLabel(i.ToString()); // Index 22 | var fieldValue = new TypeInspector(item, new ViewContext() {Mode = ViewMode.Default}); 23 | 24 | var propertyValueGroup = new VisualElement(); 25 | propertyValueGroup.AddToClassList("propertyValueGroup"); 26 | propertyValueGroup.Add(propertyLabel); 27 | propertyValueGroup.Add(fieldValue); 28 | 29 | Add(propertyValueGroup); 30 | 31 | i++; 32 | } 33 | 34 | if (isClipped) 35 | { 36 | var expander = new Span("(...)"); 37 | Add(expander); 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandedArrayGroup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8acf53476a004021a7afa2d1fa4aab2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandedClassType.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Linq; 3 | using UnityEngine; 4 | using UnityEngine.UIElements; 5 | 6 | namespace UnityEditor.ImmediateWindow.UI 7 | { 8 | public class ExpandedClassType : VisualElement 9 | { 10 | public ExpandedClassType(object obj) 11 | { 12 | if (obj.GetType().GetInterfaces().Any()) 13 | Add(new ExtendedExpandable("Interfaces", new ExpandedInterfaceGroup(obj), expanded: false, labelClassNames: "expandedClassLabel")); 14 | 15 | var properties = new ExtendedExpandable("Properties", new ExpandedPropertyGroup(obj), expanded: true, labelClassNames: "expandedClassLabel"); 16 | Add(properties); 17 | 18 | if (obj.GetType().GetMethods().Any()) 19 | Add(new ExtendedExpandable("Methods", new ExpandedMethodGroup(obj), labelClassNames: "expandedClassLabel")); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandedClassType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d4586878bebb0420facb5b41faae3f61 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandedDictionaryGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Linq; 3 | using UnityEngine.UIElements; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | // TODO: The Expanded+Collapsed Object/Array/Dictionary groups are very redundant 8 | internal class ExpandedDictionaryGroup : VisualElement 9 | { 10 | public ExpandedDictionaryGroup(IDictionary obj) 11 | { 12 | AddToClassList("expandedArrayGroup"); 13 | 14 | var i = 0; 15 | foreach (var key in obj.Keys) 16 | { 17 | if (i > Config.ShowMaxCollapsedArrayItems) 18 | break; 19 | 20 | var propertyLabel = new ProperyTypeLabel(key); 21 | var fieldValue = new TypeInspector(obj[key], new ViewContext {Mode = ViewMode.Default}); 22 | 23 | var propertyValueGroup = new VisualElement(); 24 | propertyValueGroup.AddToClassList("propertyValueGroup"); 25 | propertyValueGroup.Add(propertyLabel); 26 | propertyValueGroup.Add(fieldValue); 27 | 28 | Add(propertyValueGroup); 29 | 30 | i++; 31 | } 32 | 33 | if (i > Config.ShowMaxCollapsedArrayItems) 34 | { 35 | var expander = new Span("(...)"); 36 | Add(expander); 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandedDictionaryGroup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79efad41f544f431fa55712635d71e78 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandedInterfaceGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | internal class ExpandedInterfaceGroup : VisualElement 7 | { 8 | public ExpandedInterfaceGroup(object obj) 9 | { 10 | foreach (var interfaceType in obj.GetType().GetInterfaces()) 11 | { 12 | Add(new Interface(interfaceType, obj)); 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandedInterfaceGroup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2f1cef8f93e04f32a4b2cd00ce063d0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandedMethodGroup.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UIElements; 2 | 3 | namespace UnityEditor.ImmediateWindow.UI 4 | { 5 | internal class ExpandedMethodGroup : VisualElement 6 | { 7 | public ExpandedMethodGroup(object obj) 8 | { 9 | foreach (var method in obj.GetType().GetMethods()) 10 | { 11 | Add(new Method(method, obj)); 12 | } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandedMethodGroup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cbd8172f2fb844338b45a739a53b1138 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandedPropertyGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | public class ExpandedPropertyGroup : VisualElement 7 | { 8 | public ExpandedPropertyGroup(object obj) 9 | { 10 | AddToClassList("expandedPropertyGroup"); 11 | 12 | // 13 | // Properties 14 | var properties = PropertyUtils.GetPropertyInfo(obj).ToList(); 15 | bool isClipped = properties.Count > Config.ShowMaxBlockProperties; 16 | properties = properties.Take(Config.ShowMaxBlockProperties).ToList(); 17 | 18 | foreach (var property in properties) 19 | { 20 | Add(new PropertyValueGroup(property, new ViewContext {Mode = ViewMode.Default})); 21 | } 22 | 23 | if (isClipped) 24 | { 25 | var expander = new Span("(...)"); 26 | Add(expander); 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ExpandedPropertyGroup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7530cf245737d497785b646b5353478a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/Interface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | internal class Interface : VisualElement 7 | { 8 | public Interface(Type interfaceType, object obj) 9 | { 10 | var parsed = new ParsedAssemblyQualifiedName.ParsedAssemblyQualifiedName(interfaceType.AssemblyQualifiedName, true); 11 | var parsedLong = new ParsedAssemblyQualifiedName.ParsedAssemblyQualifiedName(interfaceType.AssemblyQualifiedName); 12 | 13 | var interfaceSpan = new Span(parsed.CSharpStyleName.Value, "interface"); 14 | interfaceSpan.tooltip = parsedLong.CSharpStyleName.Value; 15 | Add(interfaceSpan); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/Interface.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2656faf8fb6324ca7aac1d1e581682f5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/Method.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Reflection; 3 | using UnityEngine.UIElements; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | public class Method : VisualElement 8 | { 9 | public Method(MethodInfo info, object obj) 10 | { 11 | Add(new Span(info.ReturnType.Name + " ", "return")); 12 | Add(new Span(info.Name, "name")); 13 | 14 | var parameters = new Container("parameters"); 15 | parameters.Add(new Span("(")); 16 | 17 | var parameterInfos = info.GetParameters(); 18 | foreach (var arg in parameterInfos) 19 | { 20 | var parameter = new Container("parameter"); 21 | parameter.Add(new Span(arg.ParameterType.Name + " ", "parameterType", arg.ParameterType.FullName)); 22 | parameter.Add(new Span(arg.Name, "parameterName")); 23 | 24 | parameters.Add(parameter); 25 | 26 | if (arg != parameterInfos.Last()) 27 | parameter.Add(new Span(", ")); 28 | } 29 | 30 | parameters.Add(new Span(")")); 31 | 32 | Add(parameters); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/Method.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd253906bac9444c6a23b5d2ed4198f4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/PropertyValueGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.UIElements; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | public class PropertyValueGroup : VisualElement 8 | { 9 | public PropertyValueGroup(PropertyInfo property, ViewContext context) 10 | { 11 | AddToClassList("propertyValueGroup"); 12 | if (property.IsPrivate) 13 | { 14 | AddToClassList("private"); 15 | RegisterCallback(e => { 16 | e.rect = worldBound; 17 | e.tooltip = string.Format("Property {0} is private.", property.Field.Name); 18 | e.StopImmediatePropagation(); 19 | }); 20 | } 21 | 22 | // These generate exception with a Type. So skip until I know why 23 | if (property.GeneratesExceptions) 24 | return; 25 | 26 | var propertyLabel = new ProperyLabel(property.Label); 27 | var fieldValue = new TypeInspector(property.Value, context); 28 | 29 | Add(propertyLabel); 30 | Add(fieldValue); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/PropertyValueGroup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 03bffeb303f66458f981e48dd99930eb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ProperyLabel.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UIElements; 2 | 3 | namespace UnityEditor.ImmediateWindow.UI 4 | { 5 | public class ProperyLabel : VisualElement 6 | { 7 | public ProperyLabel(string property) 8 | { 9 | AddToClassList("propertyLabelGroup"); 10 | 11 | var propertLabel = new Span(property); 12 | propertLabel.AddToClassList("propertyLabel"); 13 | Add(propertLabel); 14 | Add(new Span(": ")); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ProperyLabel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f99c02a6d1384c7babbbf885dff90e6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ProperyTypeLabel.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UIElements; 2 | 3 | namespace UnityEditor.ImmediateWindow.UI 4 | { 5 | public class ProperyTypeLabel : VisualElement 6 | { 7 | public ProperyTypeLabel(object property) 8 | { 9 | AddToClassList("propertyLabelGroup"); 10 | 11 | var propertLabel = new TypeInspector(property, new ViewContext {Mode = ViewMode.Value}); 12 | propertLabel.AddToClassList("propertyLabel"); 13 | Add(propertLabel); 14 | Add(new Span(": ")); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/ProperyTypeLabel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07bdd120849354ae79a595ca80cdb912 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/TypeViewMenu.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | internal class TypeViewMenu : VisualElement 7 | { 8 | private ViewContext Context { get; set; } 9 | private Button Label { get; set; } 10 | 11 | public TypeViewMenu(object obj, ViewContext context) 12 | { 13 | Context = context; 14 | 15 | Label = new Button(); 16 | Label.AddClasses("compact"); 17 | SetButtonLabel(); 18 | Label.RegisterCallback(TypeViewersClick); 19 | Label.tooltip = "Click to switch between type views"; 20 | Add(Label); 21 | 22 | Context.OnTypeSwitch += OnTypeSwitch; 23 | } 24 | 25 | private void OnTypeSwitch(ITypeView viewer) 26 | { 27 | SetButtonLabel(); 28 | } 29 | 30 | private void SetButtonLabel() 31 | { 32 | Label.text = Context.Viewer.Name; 33 | } 34 | 35 | private void TypeViewersClick(MouseUpEvent evt) 36 | { 37 | var menu = new GenericMenu(); 38 | foreach (var viewer in Context.Viewers) 39 | { 40 | menu.AddItem(new GUIContent(viewer.Name), false, obj => Context.SwitchType(viewer), null); 41 | } 42 | 43 | var menuPosition = new Vector2(Label.layout.xMin, Label.layout.center.y); 44 | menuPosition = this.LocalToWorld(menuPosition); 45 | var menuRect = new Rect(menuPosition, Vector2.zero); 46 | menu.DropDown(menuRect); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/TypeViewMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcebce423cfa749148aa7448dbe7ffe9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/TypeViewQuickSwitch.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | internal class TypeViewQuickSwitch : Label 7 | { 8 | private ViewContext Context { get; set; } 9 | 10 | public TypeViewQuickSwitch(object obj, ViewContext context) 11 | { 12 | Context = context; 13 | 14 | this.AddClasses("icon viewFull"); 15 | RegisterCallback(OnTypeSwitchClick); 16 | tooltip = "Click to switch between type views"; 17 | 18 | Context.OnTypeSwitch += OnTypeSwitch; 19 | OnTypeSwitch(Context.Viewer); 20 | } 21 | 22 | private void OnTypeSwitch(ITypeView viewer) 23 | { 24 | // First viewer is the default object one 25 | if (Context.Viewer == Context.Viewers.First()) 26 | { 27 | RemoveFromClassList("node1"); 28 | AddToClassList("node0"); 29 | } 30 | else 31 | { 32 | RemoveFromClassList("node0"); 33 | AddToClassList("node1"); 34 | } 35 | } 36 | 37 | private void OnTypeSwitchClick(MouseDownEvent evt) 38 | { 39 | if (Context.Viewer == Context.Viewers.First()) 40 | Context.SwitchType(Context.Viewers.Last()); 41 | else 42 | Context.SwitchType(Context.Viewers.First()); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/TypeViewQuickSwitch.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8fbe3bb3c0fa4c53aed3aedd047a40e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/TypeViewSelection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using UnityEngine.UIElements; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | internal class TypeViewSelection : VisualElement 8 | { 9 | private ViewContext Context { get; set; } 10 | 11 | public TypeViewSelection(object obj, ViewContext context) 12 | { 13 | Context = context; 14 | 15 | // Don't show type selector if there is only one type 16 | if (context.Viewers.Count() > 1) 17 | { 18 | if (Context.Viewers.Count() > 2) 19 | Add(new TypeViewMenu(obj, context)); 20 | 21 | Add(new TypeViewQuickSwitch(obj, context)); 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Libs/TypeViewSelection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec4934014c8094b8cafb0186e86ab6ac 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/NullType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | internal class NullType : ATypeView 7 | { 8 | public override double Priority {get { return 0; }} 9 | 10 | public override bool HasView(Type type) 11 | { 12 | return type == null; 13 | } 14 | 15 | public override VisualElement GetView(object obj, ViewContext context) 16 | { 17 | return Text.Create("null", true, "isNull"); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/NullType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 39c9d97baaa25495da2758f113ec2cb8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/ObjectType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | internal class ObjectType : ITypeView 7 | { 8 | public string Name { get; } = "Object"; 9 | public double Priority {get { return -1; }} // Lower priority then standard 10 | 11 | public bool HasView(Type type) 12 | { 13 | if (type == null) return false; 14 | 15 | return true; 16 | } 17 | 18 | public VisualElement GetView(object obj, ViewContext context) 19 | { 20 | if (context.Mode == ViewMode.Default) 21 | return new ExpandableObject(obj, context); 22 | 23 | if (context.Mode == ViewMode.Collapsed) 24 | return new CollapsedPropertyGroup(obj); 25 | if (context.Mode == ViewMode.Expanded) 26 | return new ExpandedClassType(obj); 27 | if (context.Mode == ViewMode.Value) 28 | return new TypeNameView(obj); 29 | 30 | throw new Exception("Should not get here"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/ObjectType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: afd767b24161b432fadd5d79ec3cf15e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/StringType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | internal class StringType : ATypeView 7 | { 8 | public override bool HasView(Type type) 9 | { 10 | if (type == null) return false; 11 | 12 | return type == typeof(string); 13 | } 14 | 15 | public override VisualElement GetView(object obj, ViewContext context) 16 | { 17 | var label = string.Format("\"{0}\"", obj.ToString()); 18 | var primitiveLabel = Text.Create(label, true, "isString"); 19 | 20 | return primitiveLabel; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/StringType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a7655e79672544e2b28fcdc39b509dc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/ValueType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | internal class ValueType : ATypeView 7 | { 8 | public override bool HasView(Type type) 9 | { 10 | if (type == null) return false; 11 | 12 | return type.IsPrimitive; 13 | } 14 | 15 | public override VisualElement GetView(object obj, ViewContext context) 16 | { 17 | var primitiveLabel = Text.Create(obj.ToString(), true, "isNumber"); 18 | return primitiveLabel; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/ValueType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 734e6a562bd304637a0b41164aab1790 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Views.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e05a1fe7b713940a8bf7beb285df8494 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Views/ClassView.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor.ImmediateWindow.Services; 2 | using UnityEngine; 3 | using UnityEngine.UIElements; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | public class ClassView : VisualElement 8 | { 9 | private ExtendedExpandable Content { get; set; } 10 | 11 | private object CurrentObject { get; set; } 12 | private ViewContext Context { get; set; } 13 | 14 | private Span PinnedItem { get; set; } 15 | private string PinnedSymbol { get; set; } 16 | private bool Pinned { get; set; } 17 | 18 | 19 | public ClassView(object obj, ViewContext context) 20 | { 21 | var viewFull = new Label(); 22 | viewFull.AddClasses("icon node1 viewFull"); 23 | var views = new Container("viewModes"); 24 | 25 | Content = new ExtendedExpandable(); 26 | Content.Tools.Add(views); 27 | 28 | Add(Content); 29 | 30 | PinnedItem = new Span(); 31 | PinnedItem.name = "pinned-symbol"; 32 | PinnedItem.RegisterCallback(e => { 33 | e.rect = PinnedItem.worldBound; 34 | e.tooltip = string.Format("Use {0} to refer to this element", PinnedSymbol); 35 | e.StopImmediatePropagation(); 36 | }); 37 | 38 | SetObject(obj, context); 39 | 40 | Content.OnExpandStateChanged += OnExpandState; 41 | } 42 | 43 | public void SetObject(object obj, ViewContext context) 44 | { 45 | CurrentObject = obj; 46 | Context = context; 47 | 48 | Content.Label = new TypeNameView(CurrentObject); 49 | Content.Label.RegisterCallback(OnTypeClick); 50 | 51 | OnExpandState(Content.Expanded); 52 | } 53 | 54 | private void OnExpandState(bool expanded) 55 | { 56 | // Prevent infinite recursion by only creating expanded element on demande 57 | // (since properties can be self-referential) 58 | if (expanded) 59 | { 60 | Content.CollapsedView = new VisualElement(); 61 | Content.ExpandedView = new ExpandedClassType(CurrentObject); 62 | } 63 | else 64 | { 65 | Content.ExpandedView = new VisualElement(); 66 | Content.CollapsedView = new CollapsedPropertyGroup(CurrentObject); 67 | } 68 | } 69 | 70 | async void OnTypeClick(MouseDownEvent evt) 71 | { 72 | Debug.Log("Type clicked!!"); 73 | PinnedSymbol = await Evaluator.Instance.AddToNextGlobal(CurrentObject, () => 74 | { 75 | PinnedSymbol = ""; 76 | PinnedItem.text = ""; 77 | }); 78 | 79 | PinnedItem.text = string.Format("== {0}", PinnedSymbol); 80 | Pinned = true; 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Views/ClassView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 906134fd1aee24804b95c9abb7b4b7b7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Views/TypeNameView.cs: -------------------------------------------------------------------------------- 1 | namespace UnityEditor.ImmediateWindow.UI 2 | { 3 | public class TypeNameView : Span 4 | { 5 | public TypeNameView(object obj) 6 | { 7 | var type = obj.GetType(); 8 | var parsed = new ParsedAssemblyQualifiedName.ParsedAssemblyQualifiedName(type.AssemblyQualifiedName); 9 | Init(type.Name, "typename", parsed.CSharpStyleName.Value); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/QuickInspector/TypeViews/Views/TypeNameView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 685a3d8e4124e47469818edeab5e60a8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18a75b2443aa9414bab184b3a781d8da 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/AssemblyInspector.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using UnityEditor.ImmediateWindow.Services; 3 | using UnityEngine.UIElements; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | internal class AssemblyInspector : VisualElement 8 | { 9 | internal new class UxmlFactory : UxmlFactory { } 10 | 11 | private Arrow Arrow { get; set; } 12 | private VisualElement Label { get; set; } 13 | private VisualElement Container { get; set; } 14 | private bool Expanded { get; set; } 15 | private Assembly Assembly { get; set; } 16 | 17 | public AssemblyInspector() { } 18 | 19 | public AssemblyInspector(Assembly assembly) 20 | { 21 | Assembly = assembly; 22 | AddToClassList("assembly"); 23 | 24 | Label = new VisualElement(); 25 | Label.AddToClassList("row"); 26 | 27 | Arrow = new Arrow(Arrow.Direction.Right); 28 | Label.Add(Arrow); 29 | 30 | var label = new Label(assembly.GetName().Name); 31 | label.AddToClassList("assembly-label"); 32 | Label.Add(label); 33 | 34 | Add(Label); 35 | 36 | Container = new VisualElement(); 37 | Add(Container); 38 | 39 | Label.RegisterCallback(OnLabelClick); 40 | } 41 | 42 | private void OnLabelClick(MouseDownEvent evt) 43 | { 44 | Expanded = !Expanded; 45 | Arrow.SetDirection(Expanded ? Arrow.Direction.Down : Arrow.Direction.Right); 46 | 47 | if (Expanded) 48 | { 49 | foreach (var ns in Inspector.GetAllNamespaces(Assembly)) 50 | { 51 | var inspector = new NamespaceInspector(ns, Assembly); 52 | Container.Add(inspector); 53 | } 54 | } 55 | else 56 | { 57 | Container.Clear(); 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/AssemblyInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a0e560beb4de4af7af12a157074576b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/Console.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1dcbab9514994791a1e3a065f3215a1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/Console/Console.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using UnityEngine.UIElements; 3 | using UnityEditor.ImmediateWindow.Services; 4 | using UnityEngine; 5 | using Evaluator = UnityEditor.ImmediateWindow.Services.Evaluator; 6 | using UnityEditor.Analytics; 7 | 8 | namespace UnityEditor.ImmediateWindow.UI 9 | { 10 | internal class Console : VisualElement 11 | { 12 | internal new class UxmlFactory : UxmlFactory { } 13 | 14 | private readonly VisualElement root; 15 | private TextField ConsoleInput { get; set; } 16 | private TextField ConsoleInputMultiLine { get; set; } 17 | private bool MultiLineMode 18 | { 19 | get { return State.Instance.MultiLineMode;} 20 | set { State.Instance.MultiLineMode = value; } 21 | } 22 | public Command CurrentCommand { get; set; } 23 | 24 | public ConsoleOutput ConsoleOutput { get; set; } 25 | public ConsoleOutput ConsoleOutputMultiline { get; set; } 26 | 27 | /// 28 | /// Todo: separate in different class multiline/singleline 29 | /// 30 | public Console() 31 | { 32 | root = Resources.GetTemplate("Console.uxml"); 33 | Add(root); 34 | root.StretchToParentSize(); 35 | 36 | ConsoleOutput = new ConsoleOutput(); 37 | ConsoleOutput.name = "console-output"; 38 | 39 | ConsoleInput = new TextField(); 40 | ConsoleInput.multiline = false; 41 | ConsoleInput.name = "console-input"; 42 | ConsoleInput.RegisterCallback(evt => 43 | { 44 | if (!IsKeyEventUp(evt.keyCode) && evt.keyCode != KeyCode.None) 45 | OnInputKeyPressed(evt.keyCode, evt.character); 46 | }); 47 | // Currently a bug where KeyDown event is not sent for up/down arrow 48 | ConsoleInput.RegisterCallback(evt => 49 | { 50 | if (IsKeyEventUp(evt.keyCode)) 51 | OnInputKeyPressed(evt.keyCode, evt.character); 52 | }); 53 | ConsoleSingleLine.Add(ConsoleOutput); 54 | ConsoleSingleLine.Add(ConsoleInput); 55 | 56 | ConsoleInputMultiLine = new TextField(); 57 | ConsoleInputMultiLine.multiline = true; 58 | ConsoleInputMultiLine.name = "console-input-multiline"; 59 | ConsoleMultiLine.Add(ConsoleInputMultiLine); 60 | ConsoleInputMultiLine.RegisterCallback(OnMultiLineInputKeyPressed); 61 | ConsoleInputMultiLine.RegisterCallback(OnMultiLineFocusOut); 62 | 63 | ConsoleToolbar.Console = this; 64 | 65 | SetMode(MultiLineMode); 66 | } 67 | 68 | private bool IsKeyEventUp(KeyCode keyCode) 69 | { 70 | return keyCode == KeyCode.UpArrow || keyCode == KeyCode.DownArrow || keyCode == KeyCode.Return; 71 | } 72 | 73 | private void OnMultiLineFocusOut(FocusOutEvent evt) 74 | { 75 | SaveMultiLineState(); 76 | } 77 | 78 | public void SetMode(bool multiline) 79 | { 80 | var changed = MultiLineMode == multiline; 81 | MultiLineMode = multiline; 82 | 83 | if (MultiLineMode) 84 | { 85 | if (ConsoleSingleLine.Contains(ConsoleOutput)) 86 | ConsoleSingleLine.Remove(ConsoleOutput); 87 | 88 | UIUtils.SetElementDisplay(ConsoleSingleLine, !MultiLineMode); 89 | UIUtils.SetElementDisplay(ConsoleMultiLine, MultiLineMode); 90 | 91 | 92 | ConsoleMultiLine.Add(ConsoleOutput); 93 | RemoveFromClassList("singleline"); 94 | AddToClassList("multiline"); 95 | 96 | SetMultilineCode(State.Instance.ScriptCode, false); 97 | } 98 | else 99 | { 100 | // Make sure we store current script since we always restore it from state 101 | // when changing mode 102 | if (changed) 103 | SaveMultiLineState(); 104 | 105 | if (ConsoleMultiLine.Contains(ConsoleOutput)) 106 | ConsoleMultiLine.Remove(ConsoleOutput); 107 | 108 | UIUtils.SetElementDisplay(ConsoleSingleLine, !MultiLineMode); 109 | UIUtils.SetElementDisplay(ConsoleMultiLine, MultiLineMode); 110 | 111 | ConsoleSingleLine.Insert(0, ConsoleOutput); 112 | AddToClassList("singleline"); 113 | RemoveFromClassList("multiline"); 114 | } 115 | 116 | ConsoleOutput.ResetScrollView(true); 117 | } 118 | 119 | private async void OnMultiLineInputKeyPressed(KeyUpEvent evt) 120 | { 121 | var doEvaluate = false; 122 | switch (evt.keyCode) 123 | { 124 | case KeyCode.Escape: 125 | break; 126 | case KeyCode.Return: 127 | case KeyCode.KeypadEnter: 128 | { 129 | if (evt.ctrlKey || evt.commandKey) 130 | { 131 | doEvaluate = true; 132 | evt.PreventDefault(); 133 | evt.StopImmediatePropagation(); 134 | } 135 | break; 136 | } 137 | } 138 | 139 | if (doEvaluate) 140 | await CodeEvaluate(); 141 | } 142 | 143 | private async void OnInputKeyPressed(KeyCode keyCode, char character) 144 | { 145 | var doEvaluate = false; 146 | switch (keyCode) 147 | { 148 | case KeyCode.UpArrow: 149 | { 150 | PreviousCommand(); 151 | break; 152 | } 153 | case KeyCode.DownArrow: 154 | { 155 | NextCommand(); 156 | break; 157 | } 158 | case KeyCode.Escape: 159 | break; 160 | case KeyCode.Return: 161 | case KeyCode.KeypadEnter: 162 | doEvaluate = true; 163 | break; 164 | } 165 | 166 | if (character == '\n') 167 | doEvaluate = true; 168 | 169 | if (doEvaluate) 170 | await CodeEvaluate(); 171 | 172 | ConsoleInput.Q("unity-text-input")?.Focus(); 173 | 174 | Evaluator.Instance.GetAutocomplete(ConsoleInput.text); 175 | } 176 | 177 | public void PreviousCommand() 178 | { 179 | CurrentCommand = History.Instance.PreviousCommand(CurrentCommand); 180 | if (CurrentCommand != null) 181 | { 182 | ConsoleInput.value = CurrentCommand.code; 183 | } 184 | } 185 | 186 | public void NextCommand() 187 | { 188 | CurrentCommand = History.Instance.NextCommand(CurrentCommand); 189 | if (CurrentCommand != null) 190 | ConsoleInput.value = CurrentCommand.code; 191 | else 192 | ConsoleInput.value = ""; // Clear when reach the end 193 | } 194 | 195 | public async Task CodeEvaluate() 196 | { 197 | var code = MultiLineMode ? ConsoleInputMultiLine.text : ConsoleInput.text; 198 | if (!MultiLineMode) 199 | { 200 | CurrentCommand = null; 201 | History.Instance.AddCommand(code); 202 | ConsoleInput.value = ""; 203 | } 204 | else 205 | { 206 | SaveMultiLineState(); // Save last code to survive domain reloads 207 | } 208 | 209 | EditorAnalytics.SendEventWithLimit("evaluatecode", new ImmediateWindowAnalytics {MultilineMode = MultiLineMode}); 210 | 211 | await Evaluator.Instance.Evaluate(code); 212 | } 213 | 214 | public void SetMultilineCode(string code, bool save = true) 215 | { 216 | ConsoleInputMultiLine.value = code; 217 | 218 | if (save) 219 | SaveMultiLineState(); 220 | } 221 | 222 | public void SaveMultiLineState() 223 | { 224 | State.Instance.ScriptCode = ConsoleInputMultiLine.value ; 225 | } 226 | 227 | private VisualElement ConsoleSingleLine {get { return root.Q("console-mode-singleline"); }} 228 | private VisualElement ConsoleMultiLine {get { return root.Q("console-mode-multiline"); }} 229 | private ConsoleToolbar ConsoleToolbar {get { return root.Q("toolbarContainer"); }} 230 | } 231 | } 232 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/Console/Console.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 78313e69031664467950c976071960f8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/Console/ConsoleOutput.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Microsoft.CodeAnalysis.Scripting; 4 | using UnityEngine.UIElements; 5 | using UnityEngine; 6 | using Evaluator = UnityEditor.ImmediateWindow.Services.Evaluator; 7 | 8 | namespace UnityEditor.ImmediateWindow.UI 9 | { 10 | internal class ConsoleOutput : VisualElement 11 | { 12 | internal new class UxmlFactory : UxmlFactory { } 13 | 14 | private readonly VisualElement root; 15 | private bool isScrolled = false; 16 | public ScrollView Content { get; set; } 17 | 18 | public ConsoleOutput() 19 | { 20 | root = Resources.GetTemplate("ConsoleOutput.uxml"); 21 | Add(root); 22 | ResetScrollView(); 23 | 24 | Evaluator.Instance.OnEvaluationSuccess += OnEvaluationSuccess; 25 | Evaluator.Instance.OnEvaluationError += OnEvaluationError; 26 | Evaluator.Instance.OnBeforeEvaluation += OnBeforeEvaluation; 27 | } 28 | 29 | private void OnBeforeEvaluation(string code) 30 | { 31 | isScrolled = Content.scrollOffset.y > Content.verticalScroller.highValue; 32 | } 33 | 34 | private void OnEvaluationSuccess(string output) 35 | { 36 | Content.Add(new OutputItem(output)); 37 | 38 | EditorApplication.update += UpdateScroll; 39 | } 40 | 41 | bool SimpleOutput = false; 42 | private void OnEvaluationSuccess(object output) 43 | { 44 | if (SimpleOutput) 45 | { 46 | if (output == null) 47 | output = "(no result -- perhaps you ended your statement with a ';' ?)"; 48 | 49 | Content.Add(new OutputItem(output.ToString())); 50 | } 51 | 52 | AddObject(output); 53 | } 54 | 55 | public void AddObject(object obj) 56 | { 57 | Content.Add(new OutputItem(obj)); 58 | ScrollToEnd(); 59 | } 60 | 61 | // TODO: Doesn't quite work. 62 | // Ugly hack to try and get it to scroll at the end. Need to check with RmGui 63 | private void ScrollToEnd() 64 | { 65 | EditorApplication.update += UpdateScroll; 66 | } 67 | 68 | private void OnEvaluationError(string output, CompilationErrorException error) 69 | { 70 | Content.Add(new OutputItem(output)); 71 | 72 | ScrollToEnd(); 73 | } 74 | 75 | void UpdateScroll() 76 | { 77 | if (Content.verticalScroller.highValue != 100) 78 | Content.scrollOffset = new Vector2(0, Content.verticalScroller.highValue); 79 | 80 | EditorApplication.update -= UpdateScroll; 81 | } 82 | 83 | 84 | public void ResetScrollView(bool transferPreviousContent = false) 85 | { 86 | var previous = new List(); 87 | if (Content != null) 88 | { 89 | previous = Content.Children().ToList(); 90 | if (Children().Contains(Content)) 91 | Remove(Content); 92 | } 93 | 94 | Content = new ScrollView(); 95 | Content.name = "output-content"; 96 | Content.verticalScroller.slider.pageSize = 10; 97 | Content.contentContainer.StretchToParentWidth(); 98 | Content.StretchToParentSize(); 99 | Add(Content); 100 | 101 | // Transfer previous scrollview's content. This is a hack because ScrollView 102 | // Currently doesn't resize properly if put under a new parent. 103 | if (transferPreviousContent) 104 | { 105 | foreach (var child in previous) 106 | Content.Add(child); 107 | 108 | ScrollToEnd(); 109 | } 110 | } 111 | 112 | public void ClearLog() 113 | { 114 | // Currently need to remove the scroll view to clear it since Clear() doesn't reset scroll position. 115 | Remove(Content); 116 | ResetScrollView(); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/Console/ConsoleOutput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52517e95ece8c4ed2844e836f3c26662 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/Console/ConsoleToolbar.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20846ea24791345d79766767d3f46120 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/Console/OutputItem.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UIElements; 2 | using UnityScript.Scripting; 3 | using UnityEditor.ImmediateWindow.Services; 4 | using UnityEngine; 5 | using Evaluator = UnityEditor.ImmediateWindow.Services.Evaluator; 6 | 7 | namespace UnityEditor.ImmediateWindow.UI 8 | { 9 | internal class OutputItem : VisualElement 10 | { 11 | internal new class UxmlFactory : UxmlFactory { } 12 | 13 | private readonly VisualElement root; 14 | 15 | public OutputItem() 16 | { 17 | root = Resources.GetTemplate("OutputItem.uxml"); 18 | Add(root); 19 | 20 | AddToClassList("output-item"); 21 | } 22 | 23 | public OutputItem(string text) : this() 24 | { 25 | var textField = Text.Create(text); 26 | textField.multiline = true; 27 | textField.AddToClassList("faded"); 28 | textField.AddToClassList("console-log"); 29 | Add(textField); 30 | } 31 | 32 | public OutputItem(object obj) : this() 33 | { 34 | Add(new QuickInspector(obj)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/Console/OutputItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d499ba8e8365e4a90837bf5785d26ca2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/Context.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UIElements; 2 | 3 | namespace UnityEditor.ImmediateWindow.UI 4 | { 5 | internal class Context : VisualElement 6 | { 7 | internal new class UxmlFactory : UxmlFactory { } 8 | 9 | private readonly VisualElement root; 10 | public ContextInspector ContextInspector { get; set; } 11 | 12 | public Context() 13 | { 14 | root = Resources.GetTemplate("Context.uxml"); 15 | Add(root); 16 | root.StretchToParentSize(); 17 | 18 | Reset(); 19 | } 20 | 21 | public void Reset() 22 | { 23 | if (ContextInspector != null) 24 | Remove(ContextInspector); 25 | 26 | ContextInspector = new ContextInspector(); 27 | Add(ContextInspector); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/Context.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df4c4736bd086446b854cca50ab28840 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/ContextInspector.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor.ImmediateWindow.Services; 2 | using UnityEngine.UIElements; 3 | 4 | namespace UnityEditor.ImmediateWindow.UI 5 | { 6 | internal class ContextInspector : VisualElement 7 | { 8 | internal new class UxmlFactory : UxmlFactory { } 9 | 10 | private ScrollView Container { get; set; } 11 | public ContextInspector() 12 | { 13 | AddToClassList("context-inspector"); 14 | Refresh(); 15 | } 16 | 17 | private void Refresh() 18 | { 19 | Container = new ScrollView(); 20 | Container.contentContainer.StretchToParentWidth(); 21 | Container.StretchToParentSize(); 22 | Container.AddToClassList("context-inspector-scrollview"); 23 | 24 | foreach (var assembly in Inspector.GetAllAssemblies()) 25 | { 26 | var inspector = new AssemblyInspector(assembly); 27 | Container.Add(inspector); 28 | } 29 | 30 | Add(Container); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/ContextInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 66b6676a700cb4ebbb8da233f9a0a259 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/ImmediateWindow.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UIElements; 3 | using UnityEditor.ImmediateWindow.Services; 4 | 5 | namespace UnityEditor.ImmediateWindow.UI 6 | { 7 | public class ImmediateWindow : EditorWindow 8 | { 9 | public const string PackagePath = "Packages/com.unity.immediate-window/"; 10 | public const string ResourcesPath = PackagePath + "Editor/Resources/"; 11 | private const string TemplatePath = ResourcesPath + "Templates/ImmediateWindow.uxml"; 12 | private const string DarkStylePath = ResourcesPath + "Styles/Main_Dark.uss"; 13 | private const string LightStylePath = ResourcesPath + "Styles/Main_Light.uss"; 14 | 15 | public static ImmediateWindow CurrentWindow; 16 | 17 | internal Evaluator Evaluator; 18 | internal State State; 19 | 20 | public void OnEnable() 21 | { 22 | CurrentWindow = this; 23 | 24 | SetupAnalytics(); 25 | 26 | Evaluator.Init(ref Evaluator); 27 | State.Init(ref State); 28 | 29 | string path = EditorGUIUtility.isProSkin ? DarkStylePath : LightStylePath; 30 | rootVisualElement.styleSheets.Add(EditorGUIUtility.Load(path) as StyleSheet); 31 | 32 | var windowResource = AssetDatabase.LoadAssetAtPath(TemplatePath); 33 | if (windowResource != null) 34 | { 35 | var root = windowResource.CloneTree(); 36 | rootVisualElement.Add(root); 37 | root.StretchToParentSize(); 38 | } 39 | } 40 | 41 | private void SetupAnalytics() 42 | { 43 | int maxEventsPerHour = 100; 44 | int maxNumberOfElementInStruct = 100; 45 | string vendorKey = "unity.immediate-window"; 46 | 47 | EditorAnalytics.RegisterEventWithLimit("evaluatecode", maxEventsPerHour, maxNumberOfElementInStruct, vendorKey); 48 | } 49 | 50 | public void SetSideViewVisibility(bool visibility) 51 | { 52 | UIUtils.SetElementDisplay(SideView, visibility); 53 | } 54 | 55 | internal VisualElement Content { get { return this.rootVisualElement.Q("immediateWindow"); } } 56 | internal Context Context { get { return this.rootVisualElement.Q("context"); } } 57 | internal VisualElement SideView { get { return this.rootVisualElement.Q("sideview"); } } 58 | internal Console Console { get { return this.rootVisualElement.Q("console"); } } 59 | 60 | [MenuItem("Window/Analysis/Immediate Window")] 61 | public static void ShowPackageManagerWindow() 62 | { 63 | var window = GetWindow(false, "Immediate", true); 64 | window.minSize = new Vector2(700, 250); 65 | window.Show(); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/ImmediateWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c9d543b240a254d438eb91b58e506194 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/NamespaceInspector.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Reflection; 3 | using UnityEditor.ImmediateWindow.Services; 4 | using UnityEditor.ImmediateWindow.TestObjects; 5 | using UnityEngine; 6 | using UnityEngine.UIElements; 7 | 8 | namespace UnityEditor.ImmediateWindow.UI 9 | { 10 | internal class NamespaceInspector : VisualElement 11 | { 12 | internal new class UxmlFactory : UxmlFactory { } 13 | 14 | private Label Label { get; set; } 15 | private string Namespace { get; set; } 16 | private bool IsUsing { get; set; } 17 | private Assembly Assembly { get; set; } 18 | private VisualElement ObjectContainer { get; set; } 19 | 20 | public NamespaceInspector() { } 21 | 22 | public NamespaceInspector(string ns, Assembly assembly) 23 | { 24 | Assembly = assembly; 25 | Namespace = ns; 26 | AddToClassList("namespace"); 27 | 28 | Label = new Label(ns); 29 | Label.AddToClassList("namespace-label"); 30 | Add(Label); 31 | 32 | ObjectContainer = new VisualElement(); 33 | ObjectContainer.AddClasses("object-container"); 34 | Add(ObjectContainer); 35 | 36 | Label.RegisterCallback(OnClick); 37 | tooltip = $"Click to have namespace {ns} be used in your current context"; 38 | } 39 | 40 | // Add namespace to execution context 41 | private async void OnClick(MouseDownEvent evt) 42 | { 43 | if (IsUsing) 44 | { 45 | // Debug.Log("Cannot remove a namespace. Reset context if you want to clear them."); 46 | } 47 | else 48 | { 49 | var error = await Evaluator.Instance.AddNamespace(Namespace); 50 | if (error != null) 51 | return; 52 | 53 | Label.text = $"{Namespace} ✓"; 54 | IsUsing = true; 55 | } 56 | 57 | if (ObjectContainer.childCount > 0) 58 | ObjectContainer.Clear(); 59 | else 60 | SetNamespaceObjects(); 61 | } 62 | 63 | private void SetNamespaceObjects() 64 | { 65 | var types = Inspector.GetAllTypesWithStaticPropertiesForAssemblyNamespace(Assembly, Namespace); 66 | foreach (var type in types) 67 | { 68 | var typeContainer = new Container("type"); 69 | var typeLabel = new Label(type.Name); 70 | typeLabel.AddToClassList("typename"); 71 | 72 | typeContainer.Add(typeLabel); 73 | 74 | var propertiesContainer = new Container("typeProperties"); 75 | 76 | foreach (var property in Inspector.GetAllStaticInstancesForType(type)) 77 | { 78 | var propertyLabel = new Label(property.Label); 79 | propertyLabel.AddClasses("propertyLabel"); 80 | propertyLabel.RegisterCallback(evt => OnPropertyClick(property)); 81 | 82 | propertiesContainer.Add(propertyLabel); 83 | } 84 | 85 | typeContainer.Add(propertiesContainer); 86 | ObjectContainer.Add(typeContainer); 87 | } 88 | } 89 | 90 | void OnPropertyClick(PropertyInfo property) 91 | { 92 | ImmediateWindow.CurrentWindow.Console.ConsoleOutput.AddObject(property.Value); 93 | } 94 | 95 | } 96 | } -------------------------------------------------------------------------------- /Editor/Sources/UI/Window/NamespaceInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd84eb5947c65413ab97d020be4079a9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Unity.ImmediateWindow.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Unity.ImmediateWindow.Editor", 3 | "references": [], 4 | "includePlatforms": [ 5 | "Editor" 6 | ], 7 | "excludePlatforms": [], 8 | "allowUnsafeCode": false, 9 | "overrideReferences": true, 10 | "precompiledReferences": [ 11 | "Microsoft.CodeAnalysis.CSharp.dll", 12 | "Microsoft.CodeAnalysis.CSharp.Workspaces.dll", 13 | "Microsoft.CodeAnalysis.CSharp.Scripting.dll", 14 | "Microsoft.CodeAnalysis.dll", 15 | "Microsoft.CodeAnalysis.Scripting.dll", 16 | "Microsoft.CodeAnalysis.Workspaces.dll", 17 | "System.Collections.Immutable.dll", 18 | "System.Composition.AttributedModel.dll", 19 | "System.Composition.Convention.dll", 20 | "System.Composition.Hosting.dll", 21 | "System.Composition.Runtime.dll", 22 | "System.Composition.TypedParts.dll", 23 | "System.Reflection.Metadata.dll", 24 | "System.Runtime.Loader.dll" 25 | ], 26 | "autoReferenced": true, 27 | "defineConstraints": [], 28 | "versionDefines": [] 29 | } -------------------------------------------------------------------------------- /Editor/Unity.ImmediateWindow.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8d8b7ffe3b174a70973f2023d44bc5d 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Immediate Window copyright © 2014-2019 Unity Technologies ApS 2 | 3 | Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). 4 | 5 | Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions. 6 | -------------------------------------------------------------------------------- /LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5f852039810a4170893d7d853214f6d 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity Immediate Window 2 | 3 | An immediate window we can all believe in! 4 | 5 | Original Author and Supreme Lord Of Absoluteness Without Hesitation And Second Guessing: Mathieu Rivest 6 | 7 | [Documentation](Documentation~/com.unity.immediate-window.md) 8 | 9 | # TODO 10 | 11 | ###### MVP 12 | 13 | 1. Quick Inspector 14 | 1. Assembly 15 | 1. Responsive UI (not fixed console size) 16 | 17 | ###### Tasks 18 | ``` 19 | - Assembly references (Using namespace) 20 | + To make typing quicker 21 | * Show a list of last "usings" (assembly list with a 'using' checkbox) 22 | - Object Inspector 23 | + To show and inspect values 24 | * Add pagination for all (...) 25 | * Editing 26 | * Allow inline edit of values (eg: click on string and change it right there) 27 | - Save Settings 28 | + Better experience 29 | * Save List of 'using' 30 | * Save typing history up to xxx 31 | - Multiline 32 | + Refine a method 33 | * Show line numbers for easier debugging 34 | - Typing history 35 | + Better experience 36 | * History list 37 | * with click to paste, and double-click to call 38 | - Autocomplete 39 | + Better experience 40 | - Codebase Heat Map 41 | + Easier and intuitive code exploration 42 | - QA 43 | * Freeze-proof (while(true) {} shouldn't freeze unity/computer) 44 | ``` 45 | 46 | # Internal 47 | 48 | Useful code snippets for testing 49 | 50 | ``` 51 | #r "/Users/mathieur/organizations/unity/projects/hackweek/immediate/projects/ImmediateWindow/Library/ScriptAssemblies/Unity.ImmediateWindow.Editor.dll" 52 | 53 | UnityEditor.ImmediateWindow.UI.TestClass.Test("asdsa") 54 | using UnityEditor.ImmediateWindow.UI; TestClass.Test("asdsa") 55 | 56 | public class A {public int X {get;set;} public string Y {get {return "yes";}}}; new A() 57 | 58 | -- Multiline Output -- 59 | class A 60 | { 61 | public int X = 12; 62 | public string Name = "Mat"; 63 | } 64 | var x = new A(); 65 | x 66 | 67 | -- Using Namespace -- 68 | GameObject.Find("Main Camera") 69 | ``` 70 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49df11157e681433282bc8d5488c3797 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Tests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27b7068fc216e4ac291ed22141bfe6d0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Tests/Unity.ImmediateWindow.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Unity.ImmediateWindow.Tests", 3 | "references": [ 4 | "Unity.ImmediateWindow.Editor" 5 | ], 6 | "optionalUnityReferences": [ 7 | "TestAssemblies" 8 | ], 9 | "includePlatforms": [ 10 | "Editor" 11 | ], 12 | "excludePlatforms": [], 13 | "allowUnsafeCode": false, 14 | "overrideReferences": false, 15 | "precompiledReferences": [], 16 | "autoReferenced": true, 17 | "defineConstraints": [] 18 | } -------------------------------------------------------------------------------- /Tests/Unity.ImmediateWindow.Tests.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2cee4cdfa032342dc88564206f351fbb 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Tests/WindowTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using NUnit.Framework; 4 | using UnityEngine; 5 | using UnityEngine.TestTools; 6 | using UnityEditor.ImmediateWindow.UI; 7 | 8 | namespace UnityEditor.ImmediateWindow.UI.Tests 9 | { 10 | internal class WindowTests 11 | { 12 | // A Test behaves as an ordinary method 13 | [Test] 14 | public void ImmediateWindowWorks() 15 | { 16 | ImmediateWindow.ShowPackageManagerWindow(); 17 | Assert.That(ImmediateWindow.CurrentWindow != null); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Tests/WindowTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8884c735c54348ed8a5437e6ce26fc5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Third Party Notices.md: -------------------------------------------------------------------------------- 1 | This package contains third-party software components governed by the license(s) indicated below: 2 | 3 | Component Name: ParsedAssemblyQualifiedName 4 | 5 | License: "Microsoft Reciprocal License (Ms-RL)" 6 | 7 | [ParsedAssemblyQualifiedName License](http://universalserializer.com/documentation/license.html) 8 | -------------------------------------------------------------------------------- /Third Party Notices.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 00342f5cb3cad41768ff4dc553cedde4 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Wrapper script to make running the node.js CI script a little quicker. 4 | REM Arguments are same as for index.js 5 | 6 | SET BUILD_SCRIPT="./.build_script/node_modules/upm-template-utils/index.js" 7 | 8 | IF NOT EXIST %BUILD_SCRIPT% ( 9 | mkdir "./.build_script/node_modules" >NUL 10 | CD .build_script 11 | CALL npm install upm-template-utils --registry https://api.bintray.com/npm/unity/unity-staging --no-save --loglevel error >NUL 12 | CD .. 13 | ) 14 | 15 | IF "%1" == "" ( 16 | node %BUILD_SCRIPT% 17 | ) ELSE ( 18 | node %BUILD_SCRIPT% %* 19 | ) 20 | -------------------------------------------------------------------------------- /build.bat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: afbf08e0596dd452396eb582f820cfc1 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | BUILD_SCRIPT="./.build_script/node_modules/upm-template-utils/index.js" 4 | 5 | if [ ! -f $BUILD_SCRIPT ]; then 6 | mkdir -p "./.build_script/node_modules" 7 | cd .build_script 8 | npm install upm-template-utils --registry https://api.bintray.com/npm/unity/unity-staging --no-save --loglevel error >/dev/null 9 | cd .. 10 | fi 11 | 12 | if [ -z $1 ]; then 13 | node $BUILD_SCRIPT 14 | else 15 | node $BUILD_SCRIPT $* 16 | fi 17 | -------------------------------------------------------------------------------- /build.sh.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 249c06ba47b1b43288fad5b438cbecad 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.unity.immediate-window", 3 | "displayName": "Immediate Window", 4 | "version": "1.1.0-preview.5", 5 | "unity": "2019.2", 6 | "description": "The Immediate Window provides a way to rapidly edit and debug code. It is not a full development environment, instead it is to be used for API discovery and rapid prototyping.", 7 | "author": {"name": "Unity Technologies", "email": "mathieur@unity3d.com", "url": ""}, 8 | "keywords": [ 9 | "scripting", 10 | "ide", 11 | "development", 12 | "debug" 13 | ], 14 | "dependencies": { 15 | "com.unity.code-analysis": "0.1.0-preview.2" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 313bce7b8813346e59d451636d2579aa 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------