When first use StartClient will cause thread blocked
Options
MGMGMG
✭
in Photon Bolt
My Code:
public class InitStartClientController : MonoBehaviour {
private void Awake()
{
BoltLauncher.SetUdpPlatform(new PhotonPlatform());
}
void Start () {
BoltLauncher.StartClient();//will thread blocked
StartCoroutine(GotoClientScene());
}
void Update () {
}
IEnumerator GotoClientScene()
{
while (!(BoltNetwork.isRunning && BoltNetwork.isClient))
{
yield return null;
}
SceneManager.LoadScene("GameManager");
}
}
This code is in my scene what is "InitScene".I want to enter "GameManager" by client.
But when the game runs on the phone(Android), it blocks the thread for more than 30 seconds.After it will enter "GameManager".How can I solve this problem?
public class InitStartClientController : MonoBehaviour {
private void Awake()
{
BoltLauncher.SetUdpPlatform(new PhotonPlatform());
}
void Start () {
BoltLauncher.StartClient();//will thread blocked
StartCoroutine(GotoClientScene());
}
void Update () {
}
IEnumerator GotoClientScene()
{
while (!(BoltNetwork.isRunning && BoltNetwork.isClient))
{
yield return null;
}
SceneManager.LoadScene("GameManager");
}
}
This code is in my scene what is "InitScene".I want to enter "GameManager" by client.
But when the game runs on the phone(Android), it blocks the thread for more than 30 seconds.After it will enter "GameManager".How can I solve this problem?
0
Comments
-
Do you have a large project or scene? Does this happen in an empty project?0
-
While game is loading before starting Bolt, async load all prefabs. Once Bolt is started call BoltNetwork.LoadScene for the scene you want to load on the host. Clients will automatically load the scene on connect.0
-
Now I use StartClient in my "MainUI" scene.I need to get room list by BoltNetwork.SessionList.But problems remain.stanchion said:While game is loading before starting Bolt, async load all prefabs. Once Bolt is started call BoltNetwork.LoadScene for the scene you want to load on the host. Clients will automatically load the scene on connect.
0 -
What did you change?0
-
You need to make the other changes I made as well otherwise the problems will remain.0