Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback Scene Templates are brilliant yet painful to use

Discussion in 'Editor & General Support' started by nehvaleem, Jan 19, 2021.

  1. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    419
    Hi!
    I haven't found any similar topic so I decided to create a new one. I really wanted to have something like scene templates for some time and when they were released I was super excited. Especially because our project is fairly complicated and modular, so SceneTemplates really can help.

    BUT...

    I suspect that the team that is working on never tested it in a real-life scenario. Why? I'll try to explain from my point of view which is - working on a project with 2 scene templates and a lot of assets, I mean.. a lot :)

    1) Managing dependencies is really a pain in the ass. Without the ability to sort and search assets it is really tedious to scroll the enormous list and just checking on and off every single asset. I don't think that our templates are really big, just a couple of prefabs assembled in a particular way.
    2) When the project grows... the scene templates also grow. But I totally don't understand why. Maybe it is a bug or maybe it is a design of st. In my project, the scene templates changes by themselves. New assets, that are added to the project are being enabled in the dependencies automatically. They are not a part of the dependencies of any objects included in the scene of scene template or something. They just randomly pop up as dependencies to clone.
    3) I think that there is something wrong with the Terrain in the Scene Templates. When I try and include it to clone when creating a scene from scene template I think that terrain data isn't properly referenced from the terrain component. Unity throws a warning because terrain data is different from terrain collider or something like this.

    I really hope that someone from the scene templates team could join us and talk about it a bit more.
     
    Last edited: Jan 19, 2021
  2. Marc-Saubion

    Marc-Saubion

    Joined:
    Jul 6, 2011
    Posts:
    652
    Sadly this is a recurring theme with unity. :-/

    Here is an other example of an other feature that has been left unfinished even though fixit it would be easy. And that's a random message from yesterday...

    I hope you get a positive answer from the development team but my advice is to find a workaround as it might be a better solution.
     
  3. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    794
    Hey @nehvaleem thanks for the feedback will discuss with the PM and dev team today - can you show some examples of the breadth of content you are templating please? feel free to email me on will@unity.com if its easier.
     
    Joe-Censored likes this.
  4. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Thanks for your feedback regarding scene templates.

    1- About dependency management: we are plannign on adding a search field to help you manage dependency. I suppose it would be great to also be able to sort according to asset types.

    2- Regarding dependencies: we compute all dependencies of your scene using AssetDatabase.GetDependencies. So if your "templated scene" is modified and is added new objects the dependency list will "grow". We recompute the dependency list when the template is shown in UI or before template instantiation. If you feel "random objects" are added as dependency could you log a bug and attach your project (if possible) to the bug?


     
    Joe-Censored likes this.
  5. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Hi,

    You can debug the dependencies of your scene by right clicking on it, and choosing "Select Dependencies".

    The list of dependencies should be the same as what is computed in the Scene Template EXCEPT for Scripts and Shaders which are not flagged as cloneable dependency. select_dependencies.png select_dependencies_results.png

     
  6. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    419
    Thanks guys!
    I'll try to show you some examples from my use case in couple of days, but for now the most important parts for me are:

    This is a huge step towards more UX for me. Having a really long list in regular inspector is another topic for me, but surely search & sorting are both great improvements


    This confuses me a bit. I mean - sure, when "templated scene" changes (or prefab used in it change) the dependencies also changes, but what makes anyone certain that I want them to be cloned when creating a new scene? I feel like the scene template (and the cloning dependencies) are something that I specify. Maybe there should be some "policy" to set on a template that will define how to handle situations like this (default clone, default ignore)? Or maybe when scene dependencies changed between the moment the template was authored vs now there should be some "conflict" message that would make users to decide whether dependencies should be cloned or no?


    Apart from above, I'll try to show you guys some examples from my project but it will take me some time :)
     
    MegamaDev likes this.
  7. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Just to understand properly. Are you suggesting that:

    1- When setup the dependency list of a template shouldn't change (even if the scene itself has more or less dependencies)? In that case we could add a button to "update" dependencies.

    2- Alternatively: by default we assume users might want to clone most dependencies. Maybe "new" dependencies should be "referenced" by default? (and not cloned?)

    3- Alternatively, I don't know if you were aware of this but in the Project Settings -> Scene Template you can edit the "Default Template instantiation action" for each type of assets. By default a lot of types are set to clone. But you could remove the checkmark and make all of those "reference". Then you could specify for each template what you actively want to clone. scene_template_default_dependencies_action.png


     
  8. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    419
    I think that something between option 1 & 2 would be interesting. I think that after the user specifies dependencies they shouldn't change without him knowiing. Instead I imagine that it would be awesome if there would be some sort of a message that can something like: "dependencies in scene has changed, decide whether to clone or reference them in scene template settings"

    I know about the option that you have mentioned in 3 but it won't help my case unfortunately.
     
  9. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    The workflow you are suggesting is similar to Option #1 I suggested. Basically Dependencies are "frozen" on template creation but we can notify the user if some dependencies are outdated when the user clicks on the SceneTemplate (and on instantiation?).

     
  10. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    419
    yeah, exactly. This + better ui/ux for managing dependencies (filtering, sorting, etc) would make Scene Templates really better to work with :)
     
  11. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    419
    Hi @sebastienp_unity how it's going? Is there any progress, roadmap, upcoming features related to the scene templates available anywhere? I'm really excited about this feature being actively developed.
     
  12. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    419
    times goes by, questions left unanswered :( And I was hoping that scene templates will become awesome eventually...
     
  13. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    419
    It is getting even worse to work with the scene templates actually. My dependencies list is so huge that it probably breaks the inspector and I am unable to toggle off cloning for some assets.



    EDIT: It can be worked around by using debug view in the inspector.
     
  14. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    419
    Marc-Saubion likes this.
  15. murgonen

    murgonen

    Joined:
    May 24, 2017
    Posts:
    4
    This feature (Scene Templates) doesn't work for our workflow either. I hoped I could use the Scene Templates as basis for new "level" in an existing game but there's issues with the implementation and the UI. We're using the latest Unity 2020.3 LTS branch.

    Main issue is with the Scene Template Dependencies: Scene template system collects the dependencies too greedily.

    In my template scene, I have a prefab link to a kind of Master object that contains basically all shared game logic, that should be in every level scene. Part of this Master object is a kind of repository system that contains references to pretty much every used asset in the game since the game is pretty dynamic in nature with lots of shared objects between scenes.

    Scene Template system seems to assume I want to clone absolutely everything, even though I certainly don't want it to clone stuff that's in a linked prefab, unless I explicitly say so. For my template scene, I only want to clone 3 things (scriptable objects & terrain data). I can't find them in the thousands of dependency objects shown even though my scene is basically "empty". The object list isn't even ordered in any sensible manner, but the list is really long and slows the editor down.

    For my workflow, objects to clone should be opt-in. Currently Scene Template system seems to be designed for a "New project" thing rather than a "New scene in existing project" thing, and I need the latter.

    As a workaround, I tried to use Scene Templates by removing my Master object (hoping it will reduce the amount of dependencies in the scene) and just having the terrain there which actually has something to clone, but even now the list of assets is almost 100 items long, full of all the textures and whatnot associated with the terrain splat material (all of which are shared between the levels). I don't want changes to the material have any effect on my scene template (or vice versa) accidentally, so I prefer not to use Scene Templates for now.

    I'm also not a fan of notifying about changes to irrelevant objects. Updating template scenes should be so rare, for me updating it's dependencies should be an explicit thing to do, automatically changing files are a pain because of (mental) clutter in the version control system.

    How I would fix the Scene Templates:
    1) Have a check box tree view for the dependency items based on asset path on disk
    2) Don't assume references should be cloned unless explicitly marked as such (prevents automatic file changes when shared stuff is changed)

    I'll revert to my old way of doing this:
    1) Make a folder with the template scene stuff, including the assets that need to be cloned
    2) Have a custom level creation window that has a script that that copies your template scene folder and also renames all assets to match the new scene name
    3) Run code to fix references to the stuff that actually needed cloning, among other scene initialization like setting terrain size etc.

    Cheers.
     
  16. GamesEngineer

    GamesEngineer

    Joined:
    Aug 22, 2014
    Posts:
    9
    @sebastienp_unity - Any updates on Template Scenes? I like the concept, but the workflow is still lacking. I'll add to the discussion that modifying the project's Scene Template settings does not automatically check out the SceneTemplateSettings.json file from version control (I'm using Perforce Helix), so it results in an error:
    UnauthorizedAccessException: Access to the path "D:\p4\IoD\ProjectSettings\SceneTemplateSettings.json" is denied.
    Also, I recommend making Terrain, TerrainData, and TerrainCollider, and NavMeshData be cloned by default. Usually, different scenes represent different levels that have unique terrain geometry.
     
  17. GamesEngineer

    GamesEngineer

    Joined:
    Aug 22, 2014
    Posts:
    9
    As of Unity 2020.3.30f1, even if you mark the TerrainData as cloned, it only clones the data for the TerrainCollider component and not for the Terrain component. Consequently, I had to write a Scene Template Pipeline script that copies the TerrainData from the TerrainCollider component to the Terrain component after template instantiation.

    Code (CSharp):
    1.  
    2.     public class SceneTemplatePipeline : ISceneTemplatePipeline
    3.     {
    4.         public void AfterTemplateInstantiation(SceneTemplateAsset sceneTemplateAsset, Scene scene, bool isAdditive, string sceneName)
    5.         {
    6.             if (!scene.IsValid())
    7.             {
    8.                 Debug.LogError($"{sceneName} is invalid. Cannot run the template pipeline script.");
    9.                 return;
    10.             }
    11.             var rootObjects = scene.GetRootGameObjects();
    12.             foreach (var rootObj in rootObjects)
    13.             {
    14.                 Terrain terrain = rootObj.GetComponent<Terrain>();
    15.                 if (terrain == null) continue; // NOTE: this assumes all terrain objects are root objects
    16.                 // Copy TerrainData from the TerrainCollider component to the Terrain component.
    17.                 TerrainCollider terrainCollider = terrain.GetComponent<TerrainCollider>();
    18.                 if (terrainCollider == null) continue;
    19.                 if (terrainCollider.terrainData == null) continue;
    20.                 terrainCollider.terrainData.name = scene.name + "_Terrain"; // update the name to avoid confusion
    21.                 terrain.terrainData = terrainCollider.terrainData;
    22.             }
    23.         }
    24.  
    25.         public void BeforeTemplateInstantiation(SceneTemplateAsset sceneTemplateAsset, bool isAdditive, string sceneName)  { }
    26.  
    27.         public bool IsValidTemplateForInstantiation(SceneTemplateAsset sceneTemplateAsset)
    28.         {
    29.             return sceneTemplateAsset.isValid;
    30.         }
    31.     }
    32.  
    Remember to insert this script into your Scene Template asset.
     
  18. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    419
    I've struggled with this issue a lot, but iirc it is fixed in 2021.2. It is something :)
     
  19. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    Hi. Sorry for the late reply. Scene Template was put on maintenance a while ago. The issue you mentioned is fixed in 2022.2.

    Can you log a bug for this? This is something that can potentially hit a lot of users.

    This was fixed in 2021.2.

    Since 21.2, you can now filter the list and sort the dependencies based on their name or type.

    @Will-Goldstone there is some great feedback in this thread. It would be great to gather that information and take some time to review and act on it.
     
    MegamaDev likes this.
  20. MegamaDev

    MegamaDev

    Joined:
    Jul 17, 2017
    Posts:
    77
    This is good to hear. Let me add to the feedback pile ;)

    It came up earlier that in the Project Settings, you can change what types of assets are cloned by default. It would be great if this list started out unchecked by default. The default assumption should be "clone nothing," rather than "clone everything."

    EDIT: Once that's done, a good next step might be to crib off the Importer Preset system and introduce name-based clone conditions, e.g. "clone all Timelines by default whose names start with LevelIntro."
     
    Last edited: Jul 8, 2022
  21. jpvanoosten

    jpvanoosten

    Joined:
    Nov 20, 2009
    Posts:
    47
    I'm not sure this is the same issue, but the issue with the ever-growing enormous list of dependencies does not seem to be fixed in 2022.2 (b16).

    I have a scene template 4 GameObjects:
    upload_2022-12-2_16-36-33.png
    The Background
    GameObject
    is placeholder for a background sprite and initially just references the default
    Square
    sprite from the 2D Sprite package.

    The Animation
    GameObject
    is a placeholder for flip-book animation that will be played in the scene. It contains an
    AnimatorOverrideController
    which references 2
    AnimationClip
    s which should be cloned in the new scenes.

    The SceneTemplate for this scene should have at most 6 dependencies:
    1. The MainMenu prefab (and its dependencies unfortunately)
    2. The Main Camera prefab (and its dependencies unfortunately)
    3. The Square sprite
    4. The
      AnimatorOverrideController
      referenced in the Animation GO
    5. The 2
      AnimationClip
      referenced in the Animator
    At this point, I've used this scene template to create (about) 200 scenes, each with their own flip book animations, consisting of several textures each.

    Now when I click on the SceneTemplate, I get this:
    upload_2022-12-2_16-47-41.png
    And when I select the dependencies in the scene:
    upload_2022-12-2_16-48-25.png
    1279 Objects??? With 855 textures??

    Obviously, this is the list of textures that are referenced in the scenes that were created from the scene template, but why how what?? Why are these assets being added as dependencies to the original scene template??? This makes the scene template completely unusable to create new scenes. I'd be deleting cloned assets all day!

    Now of course, you're going to say, "Just uncheck the boxes"... but there are 1200 checkboxes! And every time I select the Scene Template asset, they reappear!

    Luckily, I'm using version control, and I keep reverting the SceneTemplate asset to fix this, but this is not cool...

    I just updated to 2022.2 hoping this issue was fixed in this version based on:
    But this doesn't seem to be the case for me.
     
    LuLusg likes this.
  22. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    Hi! The issue I mentioned was fixed is something else. The list of dependencies was broken when you had too many items in it. In your case it seems like you have many more dependencies than you expect.

    With Scene Templates, we try to detect when new dependencies have been added to the original scene and update the template accordingly. It seems that when you create a new scene based on that template, the new objects are seen as dependencies to the original gameobjects in the template, and every time you select the template asset they are recomputed and found as new dependencies.

    We will investigate on our side, but in the meantime could you log a bug? And if you could have a small self-contained project where you can repro this in the bug report that would help even more, if not no worries we will try to repro it on our end.
     
  23. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Hi JP,

    A few information regarding Scene template that might be important for this whole thread:

    1- Scene Template started as a package (in 21.X) but the package didn't last long as this was turned into a core feature. The package itself is not maintained anymore.

    2- If you find issues with Scene Template do not hesitate to log a bug especially if a Test Project can be added to the bug. As developers we receive the bugs directly in our inbox while forum threads are a bit more manual to investigate.

    3- Sorry @nehvaleem for the long update. As I said, it is more difficult to monitor forums threads than official bugs.

    We will try to fix the issue that was posted here (as well as some other smaller issues with scene template). Changes should be backported to 22.2. I am unsure how possible it will be to backport it earlier (ex: 21.3).

    Thanks for the feedback.

    Seb

     
  24. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Thanks for the feedback @MegamaDev . Our designer thought the contrary would be better: to clone everything by default except for a few exceptions.

    Good idea on name based conditions.

     
  25. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    This is a really bad issue. I will try to repro locally and fix this ASAP. I will keep you posted.

    Thanks for the feedback.

     
  26. jpvanoosten

    jpvanoosten

    Joined:
    Nov 20, 2009
    Posts:
    47
    @sebastiengrenier @sebastienp_unity Thank you for the quick reply!

    Unfortunately, I need to deliver this project this week and I need to wrap up a few things before I can do that so I don't have time to create a repro project and submit a bug report just yet... I'll try to do that next week (but you know how it goes, I have to start the next project before the previous one is done...). I'm also not sure the client will be too happy if I make the repo public, but if you send me your GitHub usernames, I can give you read access to the project that demonstrates this issue.
     
  27. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Hi JP,

    I tried to repro your workflow on my side using both 22.2 and our latest internal version 23.1.

    I created multipe scenes with animation controller and Animation clip and tried multiple instantiation but I didn't find anyway for the "Templated scene" to be "contaminated" and added new dependencies over time. I know it has been a while, but if you find any simple way to repro using a project that can be attached to the Bug Reporter do not hesitate to log a bug. I will check this ASAP.

     
  28. bnm000215

    bnm000215

    Joined:
    Sep 6, 2017
    Posts:
    4

    06:21 Unity Bug

    I found Scene Template Bug, Uncheck Clone and scroll up or down to be checked again.

    We've identified this as happening at 2022.2 and 2021.3 LTS now. There was no problem with the 2020 version.
     
  29. PixelLifetime

    PixelLifetime

    Joined:
    Mar 30, 2017
    Posts:
    90
    Hi, templates are cool, I enjoy using them, but here is a slight problem. I don't understand why my scene is a mandatory dependency for another scene.
    I have a prefab that is used in in a scene template which has an event where another prefab is used, this prefab references a scene in assets folder and this scene becomes a dependency which is okay but it's mandatory to copy but I don't need it to copy :)

    The `SceneController` prefab still references old scene, so there is no reason to copy `[Runtime][Scene]`.

    upload_2023-4-27_2-49-35.png
    ---
    upload_2023-4-27_2-50-42.png
    ---
    upload_2023-4-27_2-50-24.png

    I guess I will just delete it through code after I instantiate a template but it's not an ideal solution.
     
  30. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Hi,

    we are in bugbashing week. I just fixed this issue. By default Scene dependencies will be set to "reference" (instead of clone). And it will be possible to change this preference when the scene template is edited in the Inspector.

    This will gets backported to 22.2 and potentially 21.3 as well.

    Hope this will help your workflow. Thanks for the feedback.

    Seb

     
    PixelLifetime likes this.
  31. sviannay

    sviannay

    Joined:
    Feb 18, 2014
    Posts:
    4
    Don't know in which version it's fixed and if it's related, but in 2022.3.5f1 I can confirm the bug with "Clone" checkbox change is still present (even in debug mode I have the issue).
    Maybe related to having lot of dependencies, but when I change a clone option, if I scroll down, other unwanted are also checked.
    I even tried to Check one, unselect my scene template (so inspector not show it), Save Project, quit Editor and relaunch it but same issue.
    Then, lot of dependencies was marked as "Clone" and you can't disable it as if you change any it also change many others...
    The only way to revert back to all as "Reference" was either to revert file in VCS (but not convenient if you already made other changes) or to modify the asset file by hand (replacing all "instantiationMode: 0" properties to "instantiationMode: 1").
    Will try with small dependencies list to see if it's related to help you find the issue, but I suspect the list shown in inspector doesn't refer to correct dependency.
     
  32. sviannay

    sviannay

    Joined:
    Feb 18, 2014
    Posts:
    4
    With a small list of dependencies it works.
    But maybe it's when there's nested dependencies rather than huge dependencies list.
    Ex: A dependency prefab which reference other assets or prefabs
     
  33. cihadturhan_unity

    cihadturhan_unity

    Joined:
    Apr 19, 2021
    Posts:
    60
    Hi @sebastienp_unity, I still see this bug in 2022.3.2f1 and this bug unfortunately makes my scene template unusable.
    When I select/deselect clone checkbox it randomly changes after scroll. I guess it's a bug in the render logic of row items.

    Attaching a video of it,


    To me, it would be much easier if I just add objects I want to clone instead of seeing all the objects. And would be magnificent if it supports drag and drop.

    Thanks
     
    FunSTW likes this.
  34. cihadturhan_unity

    cihadturhan_unity

    Joined:
    Apr 19, 2021
    Posts:
    60
    FYI, if you use debug mode, at least it doesn't randomly change your Clone/Reference assignment but it's pain to change every item one by one here. Please fix this, I need it.

    upload_2023-12-24_4-23-11.png

    Edit: Updated to 2022.3.16f1, still not working :(
     
  35. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    Hi! I've successfully reproduced the issue on my side. Something must have broken it again, as I recall that we had fixed this issue in the past. I will make sure that we have proper testing for this UI.
     
    FunSTW likes this.