SimpleSpawnNoDespawn.lua 837 B

1234567891011121314151617181920212223242526
  1. ----------------------------------------------------------------------------------------------------
  2. --
  3. -- Copyright (c) Contributors to the Open 3D Engine Project.
  4. -- For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. --
  6. -- SPDX-License-Identifier: Apache-2.0 OR MIT
  7. --
  8. --
  9. --
  10. ----------------------------------------------------------------------------------------------------
  11. local SimpleSpawnNoDespawn =
  12. {
  13. Properties =
  14. {
  15. Prefab = { default=SpawnableScriptAssetRef(), description="Prefab to spawn" }
  16. },
  17. }
  18. function SimpleSpawnNoDespawn:OnActivate()
  19. self.spawnableMediator = SpawnableScriptMediator()
  20. self.ticket = self.spawnableMediator:CreateSpawnTicket(self.Properties.Prefab)
  21. self.spawnableMediator:Spawn(self.ticket)
  22. end
  23. return SimpleSpawnNoDespawn