Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

SyncedInstantiate problem

$
0
0
Hi,
I am making truesync based game and I have a little problem.. When I am instantiating a gameobject via SyncedInstantiate, the other player don't see the instantiated object.

This is the script for instantiating (values of GameObject, TSVector2 and TSQuaternion in SyncedInstantiate works fine, no need to chech them out):
using UnityEngine;
using System.Collections;
using TrueSync;

public class GameStart : TrueSyncBehaviour {
public override void OnSyncedStart()
{
Spawn();
}
public void Spawn(bool reversed){

int loadNumber = PlayerPrefs.GetInt ("choosedLoad");

for (int i = 0; i < PlayerPrefs.GetInt (loadNumber + ".counted"); i++) {
GameObject Inst = TrueSyncManager.SyncedInstantiate(Resources.Load("Buildings/Fight/" + PlayerPrefs.GetInt ((loadNumber * 100 + i).ToString () + ".building")) as GameObject, new TSVector2 ((PlayerPrefs.GetFloat ((loadNumber * 100 + i).ToString () + ".posX")), (PlayerPrefs.GetFloat ((loadNumber * 100 + i).ToString () + ".posY"))), TSQuaternion.identity);
}
}
}


Code for joining players into rooms (at different Scene):
https://drive.google.com/open?id=0B31tombwa2THMVZrb1hWdlE2TjQ

Inspector of instantiated prop:
https://drive.google.com/file/d/0B31tombwa2THNXNYdjJaeDRlNFE/view?usp=sharing


Viewing all articles
Browse latest Browse all 15755

Trending Articles