[bolt-101] BoltNetwork.Instantiate windows build direct connect multiple times via bat file problem
Options
3xbs
✭
hi,
i have an problem with instantiate of the player "cube" within an exe build
(is from the https://doc.photonengine.com/en/bolt/current/getting-started/bolt-101-getting-started )
when i build a client version that direkt connect without buttons it will connect but
if i start the exe build over an start.bat file like this :
@echo off
START client_tutorial_1.exe
START client_tutorial_1.exe
START client_tutorial_1.exe
START client_tutorial_1.exe
START client_tutorial_1.exe
BoltNetwork.Instantiate set the start position for every of the 5 client to the same position
and the rigidbody + boxcollider have fun
is there an trick to fix this ?
lg
Ben
i have an problem with instantiate of the player "cube" within an exe build
using UnityEngine;
using System.Collections;
[BoltGlobalBehaviour]
public class tutorial1_NetworkCallbacks : Bolt.GlobalEventListener {
public override void SceneLoadLocalDone(string map) {
// instantiate cube
Vector3 pos = new Vector3(Random.Range(-200,200), 20, Random.Range(-200, 200));
if(BoltNetwork.isClient) {
BoltNetwork.Instantiate(BoltPrefabs.Cube, pos, Quaternion.identity);
}
}
void Start () { }
void Update () { }
void OnGUI() { }
}
(is from the https://doc.photonengine.com/en/bolt/current/getting-started/bolt-101-getting-started )
when i build a client version that direkt connect without buttons it will connect but
if i start the exe build over an start.bat file like this :
@echo off
START client_tutorial_1.exe
START client_tutorial_1.exe
START client_tutorial_1.exe
START client_tutorial_1.exe
START client_tutorial_1.exe
BoltNetwork.Instantiate set the start position for every of the 5 client to the same position
and the rigidbody + boxcollider have fun
is there an trick to fix this ?
lg
Ben
0
Comments
-
I dont understand your problem, what is different when you start with a .bat file?0
-
hi Stanchion,
sorry i want to put two pictures but i havent done it
the instantiate position with the bat is for all 5 clients the same position (x,y,z)
a little video :
https://www.dropbox.com/s/3wloe10a7x3x85w/1.mp4?dl=0
the random range to instantiate is 200 to -200 with a spawn hight of 20,
so they fall smooth down ( if not with the bat file startet )
PS: i have written a script that display the name of the instantiatet cube
and have addet it to the prefab of the cube
using UnityEngine;
using System.Collections;
public class ben_go_name : MonoBehaviour {
void OnGUI() {
GUILayout.BeginArea(new Rect((float)(Screen.width - 200 - 10), 10f, 200f, (float)(Screen.height - 20)));
if (gameObject.name.Contains("(Clone)")) {
} else {
GUILayout.Label("Cubename is : " + gameObject.name);
}
GUILayout.EndArea();
}
}
now i see, that the 5 clients get the same cube.gameobject.name
0 -
I still don't understand what problem you're having0
-
this : https://www.dropbox.com/s/3wloe10a7x3x85w/1.mp4?dl=0
they spawn at the same frame and if i set a deley like this :using UnityEngine; using System.Collections; [BoltGlobalBehaviour] public class tutorial1_NetworkCallbacks : Bolt.GlobalEventListener { public override void SceneLoadLocalDone(string map) { // instantiate cube if(BoltNetwork.isClient) { StartCoroutine(Example()); } } void Start () { } void Update () { } void OnGUI() { } IEnumerator Example() { float timerlein = Random.Range (1.0F, 10.0F); yield return new WaitForSeconds(timerlein); Vector3 pos = new Vector3(Random.Range(-200, 200), 20, Random.Range(-200, 200)); GameObject cubespawned =BoltNetwork.Instantiate(BoltPrefabs.Cube, pos, Quaternion.identity); cubespawned.gameObject.transform.position=pos; cubespawned.gameObject.name="client_" + timerlein + "_" + Random.Range (1, 9999); } }
it will be ignored ( but only by starting from bat file.
the single start of the exe file will create correkt ( diffrent names ) like
client_1.942_" + Random.Range (1, 9999);
client_2.972_" + Random.Range (1, 9999);
client_5.000_" + Random.Range (1, 9999);
0 -
I don't see how this is a problem with Bolt. The random probably ends up with the same number because you're starting them all at the same time.0
-
i dont understand it
'starttime' + 'random waittime' = same endtime ?
why is random on every of the five clients the same
0 -
I would post this on the Unity forum or Unity answers, this doesnt really pertain to Bolt1
-
your right
that is a problem of/in the base ( unity3d ) and not the Bolt
sry for my confusion0