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

Question Placeholders while designing a scene, not visible in simulation

Discussion in 'Editor & General Support' started by mortoray, Dec 24, 2022.

  1. mortoray

    mortoray

    Joined:
    Sep 14, 2018
    Posts:
    94
    Is there a built-in feature to place objects in design mode that won't exist while running? I have the problem that the core scene of my game is dynamically generated, thus I don't see it in the designer. Now, as I add the UI portions, I need some kind of placeholders.

    Ideally I could copy/paste runtime objects into the design for a placeholder.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    I make extensive use of OnDrawGizmos... super simple to make a bunch of shapes and drop them in the scene, they just go away at runtime.
     
    mortoray likes this.
  3. mortoray

    mortoray

    Joined:
    Sep 14, 2018
    Posts:
    94
    Great! Gizmos look like what I need, thanks.
     
    Kurt-Dekker likes this.
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    Awesome... they really are a super-simple way to extend the editor visualization.

    It really gets crazy when you put your gizmo on a GameObject that has a bunch of children, such as a something like a PatrolPath that has a bunch of child GameObjects defining the Waypoints of that path.

    You're welcome to check out an example of that here:

    https://gist.github.com/kurtdekker/c2246d3780b93fe4e023695eb947e85d

    The possibilities are endless... Unity3D is a beast.
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    I almost forgot... I use this pattern a lot: I actually put extra stuff, line renderers, boxes, volumes whatever, sometimes with transparent or labeling markers in my scene, and then I mark all those objects with a script that Destroys them on awake. Sure they use a little memory and loading time but its a tiny fraction of the entire game scene, like it doesn't even show up in the rounding errors.

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. // @kurtdekker - Attach this script to GameObjects you
    4. // want to have in your scene for alignment and design,
    5. // but you want to be destroyed during real gameplay.
    6.  
    7. public class DestroyOnAwake : MonoBehaviour
    8. {
    9.     void Awake()
    10.     {
    11.         // and you can comment this out and run and you will have
    12.         // all your guides still in project at runtime!!
    13.         Destroy(gameObject);
    14.     }
    15. }