Search Unity

Destroy Group but values persist

Discussion in 'Project Tiny' started by vincismurf, Dec 26, 2018.

  1. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    194
    I have a simpleUI system when game is over this is called

    ut.EntityGroup.destroyAll(world, "game.SceneGroup");

    Later to restart the scene I call

    ut.EntityGroup.instantiate(this.world, "game.SceneGroup");

    However the values of the Camera Object's transform persist between Destroy and Instatiate.


    Is this expected? Should I initialized all the components of the scene?
     
  2. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    194
    If I do what the Basic work shop does . . . .

    Code (JavaScript):
    1.  ut.EntityGroup.destroyAll(world, this.mainGroup);
    2. ut.EntityGroup.instantiate(world, this.mainGroup);
    If I pass World from a behavior in the EntityGroup (mainGroup) being deleted. and then use the same World to instantiate the group. . . everything behaves as expected. Things are reset properly

    But
    If I use a World from a behavior in the EntityGroup (mainGroup) being deleted, and then Use a World from a behavior in a different EntityGroup(titleGroup) to instantiate EnitityGroup(mainGroup) the values from the previous instance of the mainGroup seem to carry over to the new instantiation.
     
  3. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    194
    I don't know if this is related but I don't think OnEntityDisable is being called on behaviors when they are destroyed