When first use StartClient will cause thread blocked

Options
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?

Comments

  • Do you have a large project or scene? Does this happen in an empty project?
  • MGMGMG
    Options
    stanchion said:

    Do you have a large project or scene? Does this happen in an empty project?

    My "Assets" file have 3.58G.But "InitScene" only have some GUI,and "GameManager" also.
  • MGMGMG
    Options
    MGMGMG said:

    stanchion said:

    Do you have a large project or scene? Does this happen in an empty project?

    My "Assets" file have 3.58G.But "InitScene" only have some GUI,and "GameManager" also.
    But my apk only 140 MB.
  • 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.
  • MGMGMG
    Options
    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.

    Now I use StartClient in my "MainUI" scene.I need to get room list by BoltNetwork.SessionList.But problems remain.
  • What did you change?
  • MGMGMG
    Options
    stanchion said:

    What did you change?

    Instead of using "StartClient" in the "InitScene" scene, allowing Prefabs to be loaded.
  • You need to make the other changes I made as well otherwise the problems will remain.