Author Topic: Setting TNObject ID  (Read 2731 times)

vidjogamer

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Setting TNObject ID
« on: December 07, 2013, 01:34:51 AM »
Hello, I have a basic understanding of TNet now and I have some objects synced across the network and what not. All the objects have their ID's set in the inspector, meaning they all exist in the scene beforehand. I want to know if its possible to create new TNObjects and assign them unique IDs at run time.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Setting TNObject ID
« Reply #1 on: December 07, 2013, 03:15:53 AM »
When you create objects using TNManager.Create, the new IDs will be assigned for you (for this reason leave TNO IDs at 0 on all prefabs).

vidjogamer

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Re: Setting TNObject ID
« Reply #2 on: December 07, 2013, 06:36:05 PM »
What if I wanted to use another asset such as PoolManager for object pooling?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Setting TNObject ID
« Reply #3 on: December 07, 2013, 08:23:10 PM »
Then it's up to you to manage it. But either way you need to use TNManager.Create to create them first, and just reuse them later if necessary.

pyscho2day

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 74
    • View Profile
Re: Setting TNObject ID
« Reply #4 on: December 09, 2013, 10:51:39 PM »
In the game that I am working on we do just that. We have a pool for all the lasers and missiles.  We don't create any till some one starts to shoot then we build up the pool and just use that.