Rootex icon indicating copy to clipboard operation
Rootex copied to clipboard

If selected entity is deleted, the editor crashes

Open r41k0u opened this issue 3 years ago • 1 comments

r41k0u avatar Jan 31 '22 19:01 r41k0u

Script to Reproduce:

  Hackathon = class("Hackathon")
    
  function Hackathon:initialize(entity)
      self.exports = {
          variable = "Hello Rootex!"
      }
  end

  function Hackathon:begin(entity)
      print("hello")
      self.mybox = RTX.Scene.CreateEmpty()
      self.mybox.name = "MyBox"
      self.mybox.entity:addDefaultComponent("TransformComponent")
      self.mybox.entity:addDefaultComponent("ModelComponent")
      self.mybox.entity:addDefaultComponent("BoxColliderComponent")
      self.mybox.entity.boxCollider.sleepable = false  
      RTX.GetCurrentScene():addChild(self.mybox)
  end
   
  function Hackathon:update(entity, delta)
      if RTX.Input.WasPressed("space") and #RTX.Scene.FindScenesByName("MyBox")==1 then
          RTX.GetCurrentScene():removeChild(RTX.Scene.FindScenesByName("MyBox")[1])
      end
  end
   
  function Hackathon:destroy(entity)
  end
   
  return Hackathon

Bashar-Ahmed avatar Oct 02 '22 14:10 Bashar-Ahmed