Author Topic: Networking Initialization  (Read 2240 times)

Manmax75

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 32
    • View Profile
Networking Initialization
« on: April 18, 2014, 06:03:47 AM »
Hey there, is there a way to know when all game objects have been instantiated onto the client on first join?
I have a function that needs to be run on the client but it requires that all objects already exist in the scene. I currently have it being called at Start() but this seems to call it before the objects are created due to the delay caused by packets in transit.

Cheers.

djray2k

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 4
  • Posts: 74
  • Blockey Hockey!
    • View Profile
    • Walking Talking Grilling Bear Studios
Re: Networking Initialization
« Reply #1 on: April 18, 2014, 08:24:04 AM »
Assuming you have a way to tie a game object to a network player, you could loop through all players and check to see if they have an created object yet. You could also 'pause' the game until all the objects have been created and then continue your start function.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Networking Initialization
« Reply #2 on: April 18, 2014, 05:35:39 PM »
All calls that went through TNManager.Create are guaranteed to already be instantiated when OnNetworkJoinChannel is sent.

Manmax75

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 32
    • View Profile
Re: Networking Initialization
« Reply #3 on: April 18, 2014, 06:09:37 PM »
Thankyou!