Spawn Start Position

Is there a way to set an initial Spawn start position for my playerPrefab? so When the Scene loads, TrueSync Manager will automatically spawn my player in the right position..
Something similar to "NetworkStartPosition" in Unity Network Manager

Comments

  • Hi @melmomen,

    You can use the "OnSyncedStart" function to initialize your object's position, you can take a look how we do it in "SimpleControl.cs" script.
  • melmomen
    melmomen
    edited January 2017
    Thanks a lot @JeffersonHenrique ,
    I managed to fix this by moving the player to the right position after it is spawned, using:
    tsRigidBody.MovePosition(position); in the "OnSyncedStart" function.

    So this is what I did, If any body else is interested:
    1) Created two game objects in the prefabs folder (Position_1 and position_2) and set their Transform to needed start positions.
    2) Declared an array of TsTransforms in the code -> "public GameObject[] playersPos;"
    3) From Inspector I set the length of the array and dragged my two positions to the array elements
    4) Then in "OnSyncedStart"
    myPlayer.MovePosition(playersPos[index].position);
    myPlayer.MoveRotation(playersPos[index].rotation);