Author Topic: Change player prefab  (Read 1745 times)

Elmo loves cookies

  • Jr. Member
  • **
  • Thank You
  • -Given: 60
  • -Receive: 1
  • Posts: 62
    • View Profile
Change player prefab
« on: August 11, 2016, 06:40:27 AM »
I try change Player prefab, by "tno.DestroySelf();" - for destroy old prefab and spawn new prefab by command "TNManager.Instantiate(...)"
- but sometimes "tno.DestroySelf();" don`t work and I can get two Player prefab :(

I spawning it from singleton "GameManager", and destroy from Player itself..

What the best way for changing Player prefab?))



ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Change player prefab
« Reply #1 on: August 13, 2016, 04:14:58 PM »
DestroySelf() call is not immediate. It's going to be delayed. That said, TNManager.Instantiate is also delayed, and executing one after the other should still happen in the same order. Is there anything special about the object you're destroying? Is it a properly instantiated object that exists in the channel that you're still in?