Search Unity

Feedback Nested Prefab preview scene API - OpenPreviewScene is not public but New/Close PreviewScene is

Discussion in 'Prefabs' started by Prodigga, May 19, 2019.

  1. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Hi there

    I am working on some custom editor tools for our game. In our game, we have an environment scene which contains, well, the environment. We then pile on a bunch of other scenes on top of this based on the game mode. Currently, we have to open the environment scene and then load the other scenes additively so we can 'see' what we are doing in the scene view when moving stuff around those other scenes.

    This is all fine, but it would be nice to be able to completely 'disable' or 'lock' the 'environment' scene while doing this.

    This made me think of how the nested prefab system renders the 'environment' scene in the scene view, but the environment scene is unclickable/uneditable. This is prefect. :) So I looked around to see how I could do this in my own tool and I found the NewPreviewScene and ClosePreviewScene methods. These almost do exactly what I need, except for some reason the 'OpenPreviewScene' method is not public. This method seems to be the same as NewPreviewScene except it loads an existing scene as a preview instead. Then you use ClosePreviewScene to close either of them.

    I imagine this is just an oversight? The only bit of code I found that uses this method is PrefabStagingUtility, which doesn't care if OpenPreviewScene is internal or public.

    Anyway, yeah - just wondering if we can make OpenPreviewScene public so we can use it to do some cool stuff for our own tools?
     
  2. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Hate to bump..but bump. And tagging @SteenLund since he seems to be in the know with the new nested prefab api.
     
  3. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    1,168
    +1

    OpenPreviewScene
    should be exposed

    But another thought though. I think we should not have
    OpenPreviewScene 
    .
    NewPreviewScene
    should always opened immediately. Should not need to call open after that
     
    Prodigga likes this.
  4. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123