├── Editor.meta ├── Editor ├── DOTS Entity Selection Visualizer.meta └── DOTS Entity Selection Visualizer │ ├── DOTSSelectionVisualizer.cs │ ├── DOTSSelectionVisualizer.cs.meta │ ├── SelectedEntityVisualizer.asmdef │ └── SelectedEntityVisualizer.asmdef.meta ├── README.md ├── README.md.meta ├── package.json └── package.json.meta /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9da862bb845545440b3235fce424f0d3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/DOTS Entity Selection Visualizer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9bda761632c7aa488223e219260b519 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/DOTS Entity Selection Visualizer/DOTSSelectionVisualizer.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System.Linq; 3 | using Unity.Entities; 4 | using Unity.Entities.Editor; 5 | using Unity.Transforms; 6 | using UnityEditor; 7 | using UnityEngine; 8 | 9 | public class DOTSSelectionVisualizer : EditorWindow 10 | { 11 | [MenuItem("DOTS/Selection Visualizer")] 12 | static void Open() 13 | { 14 | DOTSSelectionVisualizer win = GetWindow(); 15 | win.titleContent = new GUIContent("DOTS Selection Visualizer"); 16 | win.Show(); 17 | } 18 | 19 | private void OnEnable() 20 | { 21 | SceneView.duringSceneGui += OnSceneGUI; 22 | } 23 | 24 | private void OnDisable() 25 | { 26 | SceneView.duringSceneGui -= OnSceneGUI; 27 | } 28 | 29 | private void OnSceneGUI(SceneView obj) 30 | { 31 | var selection = Resources.FindObjectsOfTypeAll(); 32 | if (selection.Length == 0) return; 33 | 34 | var sel = selection.FirstOrDefault(s => s.Entity != Entity.Null); 35 | if (sel == null || sel.World == null || !sel.World.IsCreated) return; 36 | 37 | var entity = sel.Entity; 38 | if (entity == Entity.Null) return; 39 | 40 | var em = sel.World.EntityManager; 41 | 42 | if (!em.HasComponent(entity)) return; 43 | 44 | var rot = Quaternion.identity; 45 | if(em.HasComponent(entity)) 46 | { 47 | rot = em.GetComponentData(entity).Value; 48 | } 49 | 50 | var translation = em.GetComponentData(entity); 51 | Handles.PositionHandle(translation.Value, rot); 52 | Handles.Label(translation.Value, "Selected Entity"); 53 | HandleUtility.Repaint(); 54 | } 55 | 56 | private void OnGUI() 57 | { 58 | GUILayout.Label("Select entity in entity debugger (needs to have rotation and translation component)"); 59 | } 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /Editor/DOTS Entity Selection Visualizer/DOTSSelectionVisualizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c7d6fbfc87e473ca05be6bd8ebd56c3 3 | timeCreated: 1597651150 -------------------------------------------------------------------------------- /Editor/DOTS Entity Selection Visualizer/SelectedEntityVisualizer.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SelectedEntityVisualizer", 3 | "references": [ 4 | "Unity.Entities", 5 | "Unity.Entities.Editor", 6 | "Unity.Transforms", 7 | "Unity.Mathematics" 8 | ], 9 | "includePlatforms": [], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [], 17 | "noEngineReferences": false 18 | } -------------------------------------------------------------------------------- /Editor/DOTS Entity Selection Visualizer/SelectedEntityVisualizer.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e22c7b95f25046459a08d34e8deb510 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity DOTS Entity selection visualizer 2 | 3 | Use this tool to draw position and rotation of your Unity DOTS entities in editor. 4 | 5 | ![GIF showing tool in action](https://media.giphy.com/media/d5xB37d5q87RrF9uaU/source.gif) 6 | 7 | Currently shows position handle and label for selected entities which have Translation and Rotation component on them. 8 | 9 | # How to install? 10 | Go to "Package Manager" and add via git. 11 | 12 | ![How to add git repository based package](https://docs.unity3d.com/uploads/Main/PackageManagerUI-GitURLPackageButton.png) 13 | 14 | Enter `git://github.com/eintopf/Unity-DOTS-Entity-Selection-Visualizer` 15 | 16 | # How to use? 17 | Open "DOTS -> Selection Visualizer" in the menu bar. This will open a window which activates the entity selection visualization functionality. Attach it as a tab somewhere. 18 | Select an entity in the entity debugger list. You will see the transform handle popup for the entity in scene view. 19 | 20 | Feel free to use it and modify it. 21 | 22 | # TODO 23 | Find a nicer way to resolve the Unity selection proxy since Resources.FindObjectsOfType isn't the most elegant solution ;) This was the most straight forward solution, since I don't know exactly when the entity selection proxy (ScriptableObject) is created / destroyed. 24 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aafd449e7139f434692429c5e0f70d0f 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "email": "bennet.jeutter@gmail.com", 4 | "name": "Bennet Jeutter", 5 | "url": "https://github.com/eintopf/Unity-DOTS-Entity-Selection-Visualizer" 6 | }, 7 | "dependencies": { 8 | "com.unity.entities": "0.17.0-preview.41" 9 | }, 10 | "description": "Use this tool to draw position and rotation of your Unity DOTS entities in editor.", 11 | "displayName": "Unity DOTS Entity selection visualizer", 12 | "documentation": "https://github.com/eintopf/Unity-DOTS-Entity-Selection-Visualizer", 13 | "keywords": [ 14 | "selection", 15 | "dots", 16 | "entities", 17 | "editor" 18 | ], 19 | "name": "com.eintopf.dotsselectionvisualizer", 20 | "version" : "0.1.0", 21 | "unity": "2020.2" 22 | } 23 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1fb8f40e2db9b146b5cdd5e27908f95 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------