Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Runtime Editor

Discussion in 'Assets and Asset Store' started by Vadim-Andriyanov, May 9, 2017.

  1. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi Bryce,

    thanks for bug report and steps to reproduce,

    import attached package to fix issue
     

    Attached Files:

  2. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi, sorry for late reply

    Import attached package and open scene1, you will get this:

    upload_2019-4-8_19-12-7.png

    Main camera will be rendered inside of scene view

    If some of your scripts does not work properly, please send one of them to Battlehub@outlook.com.

    Regards,
    Vadim
     

    Attached Files:

  3. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi, HDRP is still not supported. I tried to run it on 2019.1b and 2019.2a but have no success so far. I will be trying to solve issues I have with latest unity and hdrp versions. I hope it will be supported in one of subsequent RTE updates.
     
    DavidLe360, almaris and andyfilms like this.
  4. DavidLe360

    DavidLe360

    Joined:
    Dec 24, 2018
    Posts:
    127
    Hi Vadim, no problemo.
    Is exactly what i want :)
    Again, very good asset! And thank you.
     
  5. DavidLe360

    DavidLe360

    Joined:
    Dec 24, 2018
    Posts:
    127
    Hi Vadim,

    When i create an object within Unity Editor, e.g.: a cube, then press Play button, i can not click on that object, to select it, in RTE. And it doesn't show up in the RTE hierarchy.

    What i have to do to be able to interact with it, like objects created within RTE?

    Also, i want to use RTE asset with other asset, like NGUI, GameFlow, etc.

    Thanks in advance
     
    Last edited: Apr 16, 2019
  6. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi,
    Add ExposeToEditor script to GameObject you want to edit.
    http://rteditor.battlehub.net/infrastructure/#expose-to-editor

    UnityEditor extensions can not work at runtime. Only packages that have runtime api could be integrated with Runtime Editor.
     
    DavidLe360 likes this.
  7. GDevTeam

    GDevTeam

    Joined:
    Feb 14, 2014
    Posts:
    90
    LWRP is critical for our project needs. Shader Graph will be used as well.

    Any timeline on when Unity 2019 is getting this ability?
     
  8. DavidLe360

    DavidLe360

    Joined:
    Dec 24, 2018
    Posts:
    127
    Ohh yea, it works.
    lol, i forgot the "exposeToEditor" thing.
    Thanks Vadim
     
  9. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    LWRP support is already there... in RTE 2.05 + Unity 2019.1f2 + LWRP 5.7.2, with certain issues. I will try to fix grid and selection gizmo with next update.

    Import LWRP_Prefabs_Fix.unity package from attachments and Upgrade Project Materials to LightweightRP Materials

    upload_2019-4-17_10-26-2.png


    upload_2019-4-17_10-27-43.png
     

    Attached Files:

  10. GDevTeam

    GDevTeam

    Joined:
    Feb 14, 2014
    Posts:
    90
    Thank you for the follow up.
     
  11. Adsito

    Adsito

    Joined:
    Jul 5, 2018
    Posts:
    1
    Are there any plans to implement the new Unity terrain tools into the editor?
     
  12. totrider

    totrider

    Joined:
    Jul 25, 2014
    Posts:
    13
    This sounds like it could be the solution to my current game saving problem, but after reading the documentation, i would like to confirm/know a few things first.

    Does this work with Unity version 2017.x? as my project is locked to this due to Shader Forge no being supported anymore.

    For the game that i am working on, the player progresses through levels that are randomly picked depending on various factors. Whenever the player beats a level, they can chose to "save" the area in 1 of up to 5 "save" slots. This allows them to return to saved areas in case they still have stuff they can do there.

    The way this works is by having each level be an entire scene, and then loading in a level scene additively whenever the player enters a new area. If the scene (area) is not gonna be "saved" the scene gets unloaded, otherwise each scene has 2 hierachies containing gameobjects. One hierachy contains all gameobjects that need to stay active, and the other gets disabled when switching between areas. When switching areas, the position of the hiearchy is simply moved to a Y position that is equal to 100*save-slot, or 0 if it is the active scene. I also set the scene that the player is in as the active scene in order to make use of the scenes lighting settings. Below are two images of the hiearchies when switching between a save slot and the level that the player needs to beat in order to progress to a new one.





    I also have a "bootstrapper" scene that contains gameobjects that are persistent between all areas, so stuff like the player controller that also manages level progression amongst other things. The game is about collecting resources, so each scene has a ton of trees, rocks, plants and a lot of other stuff, that can all be collected by the player. Each resource has a randomized number of resources when the level is generated, so i cant exactly re-create the level unless i save the state of each resource.

    After digging around, i read that there was no way to outright save a unity scene during runtime, and making a system that can save a ton of gameobject states sounds like a way to time intensive task.

    So i would like to know if i can use this asset to directly save the loaded scenes in their current states, so that they can be loaded the next time that the player boots up the game.

    I am also instantiating material copies that gets modified at runtime in order to account for some procedural conditions, and i seem to read that saving that might also be a bit tricky, so if this asset can handle it, that would be great.

    cheers
     
  13. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi, unfortunately unity 2017 is not supported. If you send email to Vadim.Andriyanov@outlook.com I will send you a demo project. Then if it will fit your requirements Runtime Save Load part can be modified to work with 2017, probably I could help with this.
     
  14. rgrlee71

    rgrlee71

    Joined:
    Sep 11, 2012
    Posts:
    37
    Will this work with Unity 2018.2? The store says that .3 is the minimum, but you never know if that is accurate. I had to go back to .2 because I hate the new prefab system. I don't need it and it's a pain.
     
  15. BurmesterVR

    BurmesterVR

    Joined:
    Sep 9, 2016
    Posts:
    6
    Hi! Would it be posible to use this asset in VR in any way?
     
  16. DavidLe360

    DavidLe360

    Joined:
    Dec 24, 2018
    Posts:
    127
    Hi Vadim,

    I tried to make a "right click popup Context Menu", in playmode, on the sense editor of RTE. But not successful.

    I read the manuel and it indicate about this file "Assets/Battelhub/UIControls/Menu/Scripts/СontextMenuTrigger.cs", then tried to add that script to an empty game object.

    When I right click I always see the hand icon for panning the scene view.
    (He is the file I worked on, the one you send to me).

    Thanks in advance.
    David
     

    Attached Files:

  17. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi David,

    import attached package.

    Then you can open context menu in scene view using following script:

    Code (CSharp):
    1. using Battlehub.RTCommon;
    2. using Battlehub.RTEditor;
    3. using Battlehub.UIControls.MenuControl;
    4. using UnityEngine;
    5.  
    6.  
    7. public class SceneViewContextMenuHandler : MonoBehaviour
    8. {
    9.     private RuntimeWindow m_window;
    10.     private IContextMenu m_contextMenu;
    11.     private IRTE m_rte;
    12.  
    13.     private void Start()
    14.     {
    15.         m_rte = IOC.Resolve<IRTE>();
    16.         m_window = m_rte.GetWindow(RuntimeWindowType.Scene);
    17.         m_contextMenu = IOC.Resolve<IContextMenu>();
    18.     }
    19.  
    20.     private void Update()
    21.     {
    22.         if (m_window.IsPointerOver && m_rte.ActiveWindow == m_window)
    23.         {
    24.             IInput input = m_window.Editor.Input;
    25.             if (input.GetPointerDown(1))
    26.             {
    27.                 ShowContextMenu();
    28.             }
    29.             else if (input.GetAxis(InputAxis.Z) != 0.0f)
    30.             {
    31.                 if (m_contextMenu.IsOpened)
    32.                 {
    33.                     m_contextMenu.Close();
    34.                 }
    35.             }
    36.         }
    37.     }
    38.  
    39.     private void ShowContextMenu()
    40.     {
    41.         MenuItemInfo cmd = new MenuItemInfo { Path = "My Command" };
    42.         cmd.Action = new MenuItemEvent();
    43.         cmd.Action.AddListener((args) =>
    44.         {
    45.             //IWindowManager wm = IOC.Resolve<IWindowManager>();
    46.  
    47.             Debug.Log("My Command");
    48.         });
    49.  
    50.         m_contextMenu.Open(new[]
    51.         {
    52.             cmd
    53.         });
    54.     }
    55. }
    56.  
    You can modify scene view navigation and disable right mouse button in this file:
    Assets\Battlehub\RTHandles\Scripts\Input\RuntimeSceneInput.cs

    upload_2019-5-28_10-47-33.png
     

    Attached Files:

  18. DavidLe360

    DavidLe360

    Joined:
    Dec 24, 2018
    Posts:
    127
    Thanks Vadim. It works.

    Next question: I trying to understand why a simple "OnMouseOver()", "OnMouseDown()", etc is not working on RTE. (I'am working on the same package "SceneViewOnlyExample" you sended to me).

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class MovetoMousePosition : MonoBehaviour
    6. {
    7.     void OnMouseOver()
    8.     {
    9.         //If your mouse hovers over the GameObject with the script attached, output this message
    10.         Debug.Log("Mouse is over a GUIElement or a GameObject with a Collider.");
    11.     }
    12.  
    13.     void OnMouseDown()
    14.     {
    15.         Debug.Log("OnMouseDown 20190528153118");
    16.  
    17.     }
    18. }
    Thanks in advance.
    David
     
    Last edited: Jun 1, 2019
  19. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125

    Hi David,
    attach following script to SceneView.prefab:

    Code (CSharp):
    1. using Battlehub.RTCommon;
    2. using UnityEngine;
    3.  
    4. namespace Battlehub.RTEditor
    5. {
    6.     public class RaiseMouseOverExample : MonoBehaviour
    7.     {
    8.         private RuntimeWindow m_window;
    9.  
    10.         private void Awake()
    11.         {
    12.             m_window = GetComponentInChildren<RuntimeWindow>(true);
    13.         }
    14.  
    15.         private void Update()
    16.         {
    17.             if(!m_window.IsPointerOver || m_window != m_window.Editor.ActiveWindow)
    18.             {
    19.                 return;
    20.             }
    21.  
    22.             RaycastHit hit;
    23.             if(Physics.Raycast(m_window.Pointer, out hit))
    24.             {
    25.                 if (m_window.Editor.Input.GetPointerDown(0))
    26.                 {
    27.                     hit.collider.SendMessage("OnMouseDown", SendMessageOptions.DontRequireReceiver);
    28.                 }
    29.                 else if(m_window.Editor.Input.GetPointerUp(0))
    30.                 {
    31.                     hit.collider.SendMessage("OnMouseUp", SendMessageOptions.DontRequireReceiver);
    32.                 }
    33.                 hit.collider.SendMessage("OnMouseOver", SendMessageOptions.DontRequireReceiver);
    34.             }
    35.         }
    36.     }
    37. }
    upload_2019-6-7_9-57-43.png
     
  20. Achim1967

    Achim1967

    Joined:
    May 15, 2018
    Posts:
    3
    Hello Vadim,
    after import an *.obj, I can´t move it to the Hierarchy. How can I add the "expose to Editor"-Scipt at runtime?
    I use Unity 2019.1.0f2

    Thank you for your Help
    upload_2019-6-8_20-30-39.png
     
  21. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi,

    1) Replace ImportFileDialog.cs in Assets\Battlehub\RTEditor\Scripts\Dialogs\
    2) Modify Import method in Assets\Battlehub\RTEditor\Scripts\Importers\FastObjImporter.cs
    Code (CSharp):
    1.   public override IEnumerator Import(string filePath, string targetPath)
    2.         {
    3.             Mesh mesh = ImportFile(filePath);
    4.             mesh.name = Path.GetFileName(filePath) + "Mesh";
    5.  
    6.             GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube);
    7.             go.GetComponent<MeshFilter>().sharedMesh = mesh;
    8.             go.name = Path.GetFileName(filePath);
    9.             go.SetActive(false);
    10.  
    11.             IProject project = IOC.Resolve<IProject>();
    12.             IRuntimeEditor editor = IOC.Resolve<IRuntimeEditor>();
    13.  
    14.             ProjectItem folder = project.GetFolder(Path.GetDirectoryName(targetPath));
    15.  
    16.             yield return editor.CreatePrefab(folder, go.AddComponent<ExposeToEditor>(), true, assetItems => { });
    17.             Object.Destroy(mesh);
    18.             Object.Destroy(go);
    19.         }
     

    Attached Files:

  22. SentryGames

    SentryGames

    Joined:
    Jun 4, 2014
    Posts:
    24
    Hi there :),

    I wonder if your package works with HDRP ?
    Our project is on HDRP and we need a runtime gizmo tool working on it ...

    Thx :)

    NarLoke
     
  23. Achim1967

    Achim1967

    Joined:
    May 15, 2018
    Posts:
    3

    Hello Vadim,
    it works fine. Thank You very much for your Help.
    Greetings Achim
     
  24. gromtron

    gromtron

    Joined:
    Nov 22, 2015
    Posts:
    5
    Hi Vadim,

    the "isPrefab" method in "GameObjectExtensions" checks for scene.buildIndex < 0, which seems to be true for all objects if the scene is loaded from an asset bundle. Maybe checking the name of the scene for emptyness would work? Or do you have an idea for a workaround?

    Thanks,
    Juri
     
  25. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi Juri, have you already tried to compare scene name with null? Does this work for you? http://answers.unity.com/answers/1190932/view.html
     
  26. annahofseth

    annahofseth

    Joined:
    Mar 16, 2018
    Posts:
    3
    Hi!
    I'm working with DockPanel, and I wish to position free-moving panels. I'm now trying to positioning them by setting anchors, but this messes up resizing.
    I also wish to keep a permanent docked region, that's see-through, to view my scene without using rendertexture. Kind of like empty leftover space, where the user can still dock panels beside. I've tried hiding the tab, but it re-appears when docking a panel beside it. Do you have any suggestions on how to achieve this? :)
     
  27. gromtron

    gromtron

    Joined:
    Nov 22, 2015
    Posts:
    5
  28. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Anyway you could add the gizmo stuff into the base handle package? not much in the full package I needed for my usage but the gizmo stuff would be good.
     
  29. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Try to use following code to move regions:

    Code (CSharp):
    1. using Battlehub.UIControls.DockPanels;
    2. using UnityEngine;
    3.  
    4. public class MoveRegion : MonoBehaviour
    5. {
    6.     [SerializeField]
    7.     private Region m_dragRegion;
    8.     private Vector3 m_prevPoint;
    9.  
    10.     private void Update()
    11.     {
    12.         Vector2 position = Input.mousePosition;
    13.        
    14.         if (Input.GetMouseButtonDown(0))
    15.         {
    16.             TransformPoint(position, out m_prevPoint);
    17.         }
    18.         else if(Input.GetMouseButton(0))
    19.         {
    20.             Vector3 point;
    21.             if (TransformPoint(position, out point))
    22.             {
    23.                 Vector3 delta = point - m_prevPoint;
    24.                 Debug.Log(point);
    25.                 m_prevPoint = point;
    26.                 m_dragRegion.transform.position += delta;
    27.             }
    28.         }
    29.     }
    30.  
    31.     private bool TransformPoint(Vector3 screenPoint, out Vector3 point)
    32.     {
    33.         Camera eventCamera = null;
    34.         return RectTransformUtility.ScreenPointToWorldPointInRectangle((RectTransform)m_dragRegion.transform, Input.mousePosition, eventCamera, out point);
    35.     }
    36. }
    As for "permanent docked region, that's see-through" please send your order number to Battlehub@outlook.com and I send you DockPanel package with example of this.

    Regards,
    Vadim
     
  30. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125

    If you have full package remove all folders except of these:

    upload_2019-7-1_20-12-59.png


    Regards,
    Vadim
     
  31. descrime

    descrime

    Joined:
    Jul 3, 2019
    Posts:
    1
    Hello, have a bug
    1 screen: when PositionHandleModel prefab add as Model field
    2a3744c9aaac8e28f549b0eaf0352f52.png

    2 screen : delete PositionHandleModel prefab from Model field and all work perfect
    1ddaf59af63969778079be122ad74187.png

    the same with RotationHandle and ScaleHandle, work good when all of them have null Model field.
    TransformHandles i m get from demo scene 2_SelectionComponent, there have this problem too
     
  32. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi, please send you order number to Vadim.Andriyanov@outlook.com or Battlehub@outlook.com and I will send you latest version. This bug already fixed.
     
  33. BeyondMASC

    BeyondMASC

    Joined:
    Feb 11, 2019
    Posts:
    9
    Hi Vadim, I am using the lite version of your asset and for now, works GREAT for us.

    We instantiate gameobjects and add ExposeToEditor Component to each one of them.

    The problem is that the gizmos handles does not appears in the center of the gameobject instantiated.

    Basically, the Gizmos appears at the center, (i.e. at 0,0,0) location no matter where the gameobjects is instantiated.

    The Gizmos works perfect (i.e. move, rotate, scale) but the location does not match the same location of the gameobject.

    MASC
     
    Last edited: Jul 11, 2019
  34. kagong

    kagong

    Joined:
    Jul 10, 2019
    Posts:
    1
    Hello Vadim,
    after import an *.png, I want to apply png to an object,but it doesn't work
    how can i do?
     
  35. glp344

    glp344

    Joined:
    Jun 30, 2018
    Posts:
    1
    Hello Vadim,
    Transparent material Save and run again, The object is not rendered like this
    Toggle material Rendering Mode or click shader Properties Inspector in unity editor There would be no problem
    I think it's a bug
    upload_2019-7-11_11-12-8.png
    The material properties
    upload_2019-7-11_11-14-33.png upload_2019-7-11_11-17-15.png
     
  36. perziili

    perziili

    Joined:
    Apr 24, 2018
    Posts:
    6
    Hi!

    Great asset!

    My issue is that I made an own script that allows copying whole branches of the tree. However, sometimes the result is not updated in the visible treeview. I mean I need to fold the branch, then reopen it to see the copied items in the tree. The same happens when I change the item names: the new names do not update until I open or close any branch.

    So I guess I am looking for a method to cause full or even partial redraw. How to do that?
     
    Last edited: Jul 23, 2019
  37. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi, here is how to rename game object

    Code (CSharp):
    1. using Battlehub.RTCommon;
    2. using UnityEngine;
    3. public class SetNameExample : MonoBehaviour
    4. {
    5.     void Update()
    6.     {
    7.         if(Input.GetKeyDown(KeyCode.I))
    8.         {
    9.             IRTE rte = IOC.Resolve<IRTE>();
    10.             GameObject go = rte.Selection.activeGameObject;
    11.             if(go != null)
    12.             {
    13.                 ExposeToEditor exposeToEditor = go.GetComponent<ExposeToEditor>();
    14.                 exposeToEditor.SetName("NewName")
    15.             }
    16.         }
    17.     }
    18. }
    19.  
    and here is how to refresh hierarchy window completely
    Code (CSharp):
    1. using Battlehub.RTCommon;
    2. using UnityEngine;
    3.  
    4. public class RefreshHierarchy : MonoBehaviour
    5. {
    6.     // Update is called once per frame
    7.     void Update()
    8.     {
    9.         if(Input.GetKeyDown(KeyCode.J))
    10.         {
    11.             IRTE rte = IOC.Resolve<IRTE>();
    12.             foreach (RuntimeWindow window in rte.Windows)
    13.             {
    14.                 if (window.WindowType == RuntimeWindowType.Hierarchy)
    15.                 {
    16.                     window.gameObject.SetActive(false);
    17.                     window.gameObject.SetActive(true);
    18.                 }
    19.             }
    20.         }
    21.     }
    22. }
    23.  
    Regards,
    Vadim
     
  38. perziili

    perziili

    Joined:
    Apr 24, 2018
    Posts:
    6
    Ouch, now I realize I should have mentioned that I have the VirtualizingTreeView asset only, not the whole RTE! Sorry for that. Any advice for my situation?
     
  39. csiro_rmc3

    csiro_rmc3

    Joined:
    Jun 8, 2014
    Posts:
    14
    Hi Vadim, congratulations on an impressive asset. I bought the RTEditor a couple of years ago but hadn't delved into a deeper use case until recently.

    I'm interested in using it in a user placement/configuration tool on a standard 2D main display that also has a VR preview.

    I don't yet see any mention of VR support in the manual or asset store features yet but I've noted the "Enable VR If Available" option in the Runtime Editor script and parts of the code that appear to be a start on integrating the Oculus SDK, as well as tests for VR in the code.

    For my use case, I don't need the VR view to have any support for gizmo interaction, etc. In my case I would just like the Editor UI to work in the main display alongside the game view on the VR device (I don't need preview for the VR in the editor - that would just be a bonus).

    I can somewhat get there by doing the following:
    * Make a copy of the RTEditor example
    * Enable XR support in unity (either direct Oculus support or OpenVR)
    * Disable the camera follow script on the main camera

    This has the example start and respond to the VR game camera, then:

    * Modify the RuntimeEditor prefab to disable the "Enable VR if Available" (otherwise I get an exception in RuntimeWindow.cs where it attempts to set the raycastTarget flag on a null m_background object).
    * Modify the UICamera in the RuntimeEditor prefab to set the TargetEye to None

    This then allows the Editor view to show on the main 2D display instead of in miniature on the VR device.

    However when the Editor view is activated it stops rendering the VR view on the device (just shows the last frame) until I close the Game view in the editor and re-enable the camera component on the game camera.

    Then I have the use case I was looking for - figure I'll try to disable the game view in the editor next and remove it from the default layout. Hoping that then sorts my use-case but I'm not sure if I'm taking the right approach here.

    Would you have any feedback on any plans on possible VR support for the editor please?

    Also any suggestions on a better approach to achieve what I'm looking for?
    (i.e. editor on the main screen, VR working separately but game camera perhaps still capturing and displayed in preview - I can always disable the RuntimeEditor object to return the VR preview to fullscreen on the 2D display)

    Thanks in advance,
    Craig

    [Update] - just had another idea to also get the VR game camera preview on the 2D display - just needed to leave the original Game Camera and change it's TargetEye also to None, plus add another camera for the VR (using SteamVR prefab in my case). Seems to work ok (with an understandable performance hit but that still fits my use case), then I just need to write a script to follow the VR camera. Still interested to find out any plans for further VR support if you have any update, thanks.
     
    Last edited: Jul 30, 2019
  40. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi Craig,

    thanks for feedback. VR is currently not supported, I waiting for Oculus Quest device to arrive around 15th of August. Then I probably will play with it and also will see what I can do with RTE in that direction.

    Here is workaround to render GameView using HMD:

    1. Disable "Enable VR If Available" from RuntimeEditor script
    2. Changed "TargetEye == None" in the Camera on the UICamera child object of the RuntimeEditor prefab
    3. Created another camera with "TargetEye == both". This is the VR Camera.
    4. Created a third camera with "TargetEye == None" and made it a child of the camera on step 3. Added ExposeToEditor and GameViewCamera scripts to it. This makes it visible in the editor.
    5. Enable VR in Unity settings
    6. To avoid the VR Camera rendering the editor gizmos, I made it execute the following code:
    void Start()
    {
    // This is done to ensure the VR camera does not see Editor gizmos
    cam = GetComponent<Camera>();
    IRTE Editor = IOC.Resolve<IRTE>();
    CameraLayerSettings settings = Editor.CameraLayerSettings;
    cam.cullingMask &= ~(((1 << settings.MaxGraphicsLayers) - 1) << settings.RuntimeGraphicsLayer);
    }
    Now in the editor the game view camera is rendered to the HMD and to the monitor, and the camera position and rotation is controlled by the HMD.

    Regards,
    Vadim
     
  41. perziili

    perziili

    Joined:
    Apr 24, 2018
    Posts:
    6
    There seems to be bug in VirtualizingTreeView.cs

    public static void ItemDropStdHandler<T>(this VirtualizingTreeView treeView, ItemDropArgs e,
    Func<T, T> getParent,
    Action<T, T> setParent,
    Func<T, T, int> indexOfChild,
    Action<T, T> removeChild,
    Action<T, T, int> insertChild) where T : class
    {

    T dropTarget = (T)e.DropTarget;
    //Set drag items as children of drop target
    if (e.Action == ItemDropAction.SetLastChild)
    {
    for (int i = 0; i < e.DragItems.Length; ++i)
    {
    T dragItem = (T)e.DragItems;
    removeChild(dragItem, getParent(dragItem));
    setParent(dragItem, dropTarget);
    insertChild(dragItem, getParent(dragItem), 0);
    }
    }
    ...

    When you use the above SetLastChild action by dragging items into a parent one by one, they are inserted in reverse order. Only when one folds and expands the parent, the actual order is shown.

    I fixed this by

    public static void ItemDropStdHandler<T>(this VirtualizingTreeView treeView, ItemDropArgs e,
    Func<T, T> getParent,
    Action<T, T> setParent,
    Func<T, T, int> indexOfChild,
    Action<T, T> removeChild,
    Action<T, T> addChild,
    Action<T, T, int> insertChild) where T : class
    {

    T dropTarget = (T)e.DropTarget;
    //Set drag items as children of drop target
    if (e.Action == ItemDropAction.SetLastChild)
    {
    for (int i = 0; i < e.DragItems.Length; ++i)
    {
    T dragItem = (T)e.DragItems;
    removeChild(dragItem, getParent(dragItem));
    setParent(dragItem, dropTarget);
    addChild(dragItem, getParent(dragItem)); // insertChild(dragItem, getParent(dragItem), 0);
    }
    }
    ...

    Where addChild() is simply
    (item, parent) => ChildrenOf(parent).Add(item),
     
  42. Enoch

    Enoch

    Joined:
    Mar 19, 2013
    Posts:
    198
    Awesome asset, the amount of work you have done here is staggering. This solves a very specific but perhaps not so niche problem (being able to functionally edit things at runtime with a decent user interface), but there are a ton of features here that are usable outside of that domain. Great work.

    On to my question :). Is there a easy way to create custom inspectors that have extra functionality? Things like buttons and graphics that aren't directly related to member properties?
     
    Spy-Shifty likes this.
  43. airop

    airop

    Joined:
    Sep 4, 2012
    Posts:
    34
    Hi, is it possible to build what you have created or do you always have to have the runtime editor active. for example, i want to use this to build a vr project, and then build it for android in the runtime editor.
     
  44. somosky

    somosky

    Joined:
    Feb 15, 2014
    Posts:
    138
    Hi when I'm attempting to save my scene I am getting the error message "texture encode to functions do not support compressed texture formats".

    Any idea of what needs to be done to my textures so that I can save the scenes?
     
  45. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi, texture can be decompressed using following code:

    Code (CSharp):
    1. public static Texture2D DeCompress(this Texture2D source)
    2.         {
    3.             RenderTexture renderTex = RenderTexture.GetTemporary(
    4.                         source.width,
    5.                         source.height,
    6.                         0,
    7.                         RenderTextureFormat.Default,
    8.                         RenderTextureReadWrite.Linear);
    9.             Graphics.Blit(source, renderTex);
    10.             RenderTexture previous = RenderTexture.active;
    11.             RenderTexture.active = renderTex;
    12.             Texture2D readableText = new Texture2D(source.width, source.height);
    13.             readableText.ReadPixels(new Rect(0, 0, renderTex.width, renderTex.height), 0, 0);
    14.             readableText.Apply();
    15.             RenderTexture.active = previous;
    16.             RenderTexture.ReleaseTemporary(renderTex);
    17.             return readableText;
    18.         }
    Here is how to modify ResourcePreviewUtility:

    Code (CSharp):
    1.  else if (obj is Texture2D)
    2.             {
    3.                 Texture2D texture = (Texture2D)obj;
    4.                 bool isReadable = texture.isReadable;
    5.                 bool isSupportedFormat = texture.format == TextureFormat.ARGB32 ||
    6.                                       texture.format == TextureFormat.RGBA32 ||
    7.                                       texture.format == TextureFormat.RGB24 ||
    8.                                       texture.format == TextureFormat.Alpha8;
    9.  
    10.                 if(isReadable && isSupportedFormat)
    11.                 {
    12.                     texture = Instantiate(texture);
    13.                 }
    14.                 else
    15.                 {
    16.                     texture = texture.DeCompress();
    17.                 }
    18.  
    19.                 TextureScale.Bilinear(texture, m_objectToTextureCamera.snapshotTextureWidth, m_objectToTextureCamera.snapshotTextureHeight);
    20.                 previewData = texture.EncodeToPNG();
    21.                 Destroy(texture);
    22.             }

    And here is modification of PersistentTexture2D:
    Code (CSharp):
    1.   public override void ReadFrom(object obj)
    2.         {
    3.             base.ReadFrom(obj);
    4.  
    5.             Texture2D texture = (Texture2D)obj;
    6.             if (texture == null)
    7.             {
    8.                 return;
    9.             }
    10.  
    11.             try
    12.             {
    13.                 bool supportedFormat =  texture.format == TextureFormat.ARGB32 ||
    14.                                         texture.format == TextureFormat.RGBA32 ||
    15.                                         texture.format == TextureFormat.RGB24 ||
    16.                                         texture.format == TextureFormat.Alpha8;
    17.  
    18.                 if (texture.isReadable && supportedFormat)
    19.                 {
    20.                     m_bytes = texture.EncodeToPNG();
    21.                 }
    22.                 else
    23.                 {
    24.                     Texture2D decompressed = texture.DeCompress();
    25.                     m_bytes = decompressed.EncodeToPNG();
    26.                     Object.Destroy(decompressed);
    27.                 }
    28.              
    29.                 m_isReadable = true;
    30.                 m_mipChain = texture.mipmapCount > 1;
    31.             }
    32.             catch (Exception e)
    33.             {
    34.                 Debug.LogError(e.ToString());
    35.                 m_bytes = new byte[0];
    36.                 m_isReadable = false;
    37.             }
    38.         }
     

    Attached Files:

  46. franciscochong

    franciscochong

    Joined:
    Jul 9, 2015
    Posts:
    30
    Hi does your transform handles work with webgl? i only need that feature.
    and do you draw them using gl.lines?
     
  47. Abuthar

    Abuthar

    Joined:
    Jul 12, 2014
    Posts:
    92
    How can i exclude the bounds from post effects? I was able to do it with the gizmos via layers but i can't seem to figure out the gl lines making up the bounds lines.

    Gif of my problem : https://imgur.com/2d5rZNf
     
  48. wstcgez

    wstcgez

    Joined:
    May 21, 2014
    Posts:
    12
    Hi,can you make a Timeline in the editor?
     
  49. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    Hi, I do not use selection gizmo anymore,
    could you please send email to Battlehub@outlook.com and I send you latest dev version with this
    upload_2019-10-3_9-4-22.png

    Regards,
    Vadim
     
    Last edited: Oct 3, 2019
  50. Vadim-Andriyanov

    Vadim-Andriyanov

    Joined:
    Sep 22, 2015
    Posts:
    125
    It is possible to compile and work with transform handles with webgl.
    I have legacy code to draw them using GL.Lines, but currently they are rendered as the GameObjects with the renderer and the mesh