Search Unity

Question Prefab shows on "Scene" and "Game" window. Disappears after clicking Play.

Discussion in 'Prefabs' started by PilumMuralis, Sep 16, 2020.

  1. PilumMuralis

    PilumMuralis

    Joined:
    Jun 6, 2020
    Posts:
    12
    I'm creating an infinite scrolling game where the player has to dodge incoming obstacles. I made the obstacles prefabs that will be instantiated accordingly. While I am editing the scene (dragging the prefab onto the scene), I can see it in both "Scene" and "Game" windows. The moment i click "Play", the prefab disappears. I've checked that it is on the right layer and right order. It has a "Box Collider 2D" but not a "Rigid Body 2D" so it doesn't fall out of view. It is not a child object.

    I would like to ask for advice on what could possibly be the problem.
     
    tonrafik likes this.
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Do they disappear from all views (Game view, scene view, Hierarchy window) or only some of them?

    If they disappear from all views, there is likely something in one of your scripts that deletes them.

    If they stay visible as GameObjects in the Hierarchy window but disappear in the Scene view, there is likely something that moves them to a position (far away). You can check the position in the Inspector in that case.
     
    tonrafik likes this.