- Home /
Thread assert error message when using SmartFoxServer
I am just starting out using SmartFoxServer and am trying to make a very basic "game" where "characters" (cubes) get spawned into a 3D space. I've got this working, but the following line of code seems to be causing a lot of errors to pop up when the 2nd player joins the room.
UnityEngine.Object remotePlayer = Instantiate(remotePlayerPrefab, new Vector3(50, 5, 50), new Quaternion(0,0,0,1));
I get errors like the following and can't figure out why this code would cause this, but this is the only code executed when a user joins the room and the error doesn't happen if I comment it out.
!Thread::EqualsCurrentThreadID (m_AllocThread) !Thread::EqualsCurrentThreadID(GetPersistentManager().GetMainThreadID()) && mode != kCreateObjectDontRegisterInstanceID !Thread::EqualsCurrentThreadID(GetPersistentManager().GetMainThreadID()) m_ThreadCheck && !Thread::EqualsCurrentThreadID(m_ThreadID)
Answer by Jormungandr · Apr 27, 2010 at 01:38 PM
Make sure you're running your Smartfox client in queue mode; otherwise, the Smartfox callbacks (e.g. onUserEnter) will be called by another thread. If one of those callbacks in turn calls Unity functions like Instantiate(), bad things may happen.
Your answer
![](https://koobas.hobune.stream/wayback/20220612162308im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity + SmarFox 2x via Flash export 0 Answers
What does !slot->GetLocalAABB().IsValid() mean? 3 Answers
"Assertion failed: Error querying default thread scheduling params: 3" 0 Answers
System.Threading.Thread use causing error on player exit in OSX 1 Answer
Unity Jobs Error - "Job can only create Temp memory" 1 Answer