- Home /
[URGENT] Problem with synchronizing objects loaded from server for multiplayer
Hi guys, how to synchronize an object that is loaded from a server?
When I tried running the game with the object (simple 3d cube) placed in the hierarchy window, the objects do synchronize in the players' game. I use the Network manager HUD script. The object will spawn after choosing to be a host or joining a host.
But when I built the asset bundle of this object and upload it to a server, the object would not synchronize in the players' game and this object was spawned even before I choose to be either the host or to join a host..
Please help...
I did attach the network identity script to the object. Here is my LoadAsset script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class LoadAsset : MonoBehaviour {
public GameObject cube;
// Use this for initialization
void Start () {
StartCoroutine(InstantiateObject());
}
IEnumerator InstantiateObject(){
string url = "http://192.168.137.1:8080/cube";
UnityWebRequest request = UnityWebRequest.GetAssetBundle (url, 0);
yield return request.Send ();
AssetBundle bundle = ((DownloadHandlerAssetBundle)request.downloadHandler).assetBundle;
cube = bundle.LoadAsset<GameObject> ("Cube");
Instantiate (cube);
}
}
Your answer
Follow this Question
Related Questions
Unity Network problems, updating an individual object 0 Answers
【PUN2】I want to disable the instantiation of an object in PhotonView at a specified time. 1 Answer
Player object on host can interact with objects, client players cannot. 0 Answers
Mirror Network transform not working 1 Answer
Instantiated Object not appearing for remote players 0 Answers