Author Topic: How to defer Create calls on client join until certain functions complete?  (Read 3812 times)

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
I have objects that I create using CreateEX. I need these creation calls to happen after level initialisation on the clients, because I create a procedural level on the host and send over the data for the clients to create the same level.

How do I do this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
You can't delay creation calls. What you should be doing instead is delaying whatever initialization you're doing in your scripts attached to those objects. For example if you were using pathfinding in your Start() function attached to an instantiated object, delay it like so:
  1. IEnumerator Start ()
  2. {
  3.     while (TNManager.isJoiningChannel) yield return null;
  4.     while (yourLevelIsStillInitializing) yield return null;
  5.     // ... do what you would normally be doing.
  6. }