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

Is there multiple ways to destroy an entity group?

Discussion in 'Project Tiny' started by n3wb13, Jan 21, 2019.

  1. n3wb13

    n3wb13

    Joined:
    Jul 12, 2017
    Posts:
    24
    Currently I'm using this method

    this.world.destroyEntity(entity);


    I tried it with behavior and typescript system but it always gave me an error and the game will just freeze.



    Full code:
    Code (JavaScript):
    1. let dt = this.scheduler.deltaTime();
    2.  
    3.             this.world.forEach([ut.Entity, ut.Core2D.TransformLocalPosition, game.Scroller],
    4.               (entity, position, scroller) => {
    5.  
    6.                 let p = position.position;
    7.                 p.x -= scroller.Speed * dt;
    8.                 position.position = p;
    9.  
    10.                 if(position.position.x <= -2) {
    11.                     console.log("DESTROYING PIPE!");
    12.                     this.world.destroyEntity(entity);            
    13.                  }
    14.               });
     
  2. Nkon

    Nkon

    Unity Technologies

    Joined:
    Jun 12, 2017
    Posts:
    65
  3. n3wb13

    n3wb13

    Joined:
    Jul 12, 2017
    Posts:
    24
  4. Nkon

    Nkon

    Unity Technologies

    Joined:
    Jun 12, 2017
    Posts:
    65
    Hey,

    I'm getting the same warning on Firefox, but not on Chrome.

    It means that Firefox cannot access a file, tsc-emit.js, for some reason. This file includes the code from your own scripts. However, the file should be there and I can also access it by clicking on the file name in the Firefox Web Console.

    I don't have more details to share at this point but it looks harmless to me.

    Cheers!
     
    n3wb13 likes this.
  5. n3wb13

    n3wb13

    Joined:
    Jul 12, 2017
    Posts:
    24
    Thanks for the help.