Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

[SOLVED]Playing scene populate with a custom script editor remove all gameobjects

Discussion in '2018.3 Beta' started by FlorentFal, Nov 6, 2018.

  1. FlorentFal

    FlorentFal

    Joined:
    Nov 20, 2015
    Posts:
    55
    Hello,

    I've have a weird editor behavior on my project, that I think is new (I don't remember seeing same behavior before my project upgrade to unity 2018, from u2017).

    I've got a custom editor script which create a MenuItem. When script is executed, it remove all scene's gameobject and load others base on a json file that describe a level. Problem is that once the scene is populated, playing it in editor launch the default unity scene (the one load on "New scene" action).

    Sometime unity display this message :
    "Scene(s) Have Been Modified
    Do you want to save the changes you made in the scenes:
    Untitled

    Your changes will be lost if you don't save them.

    "

    But I can't find for now the usecase that trigger it.

    It make me think about a scene serialization point but it's just an intuition.

    Thank for your help
     
    Last edited: Nov 7, 2018
  2. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    559
    does your editor script registers the modifications via
    Undo
    , or at least calls
    SetDirty
    ? if not, when you start play mode, Unity will load the scene without knowing that you modified it.
     
  3. FlorentFal

    FlorentFal

    Joined:
    Nov 20, 2015
    Posts:
    55
    Thank for your reply, but I solved my problem by :

    1. Creating an empty unity 2018 project (project "B")
    2. Copy and past my project (project "A") Asset & ProjectFolder directories to project B (here I realised that my custom script was OK and playing scene do not remove anymore gameobjects)
    3. Delete all files and directory of my project A
    4. Copy and past Asset & ProjectFolder directories of project B to project A
    5. And now it work as expected !