0
Fixed

S7 connection - get_gameObject can only be called from the main thread.

efr 3 weeks ago in realvirtual.io Starter and Professional updated by Support 2 weeks ago 3

Hi, 

When trying to make an S7 connection (new empty scene) in the realvirtual.IO starter kit I have following issue.
The connection is OK and running in Scene mode, but once in Game mode, I see I have following error:

Connection failed: get_gameObject can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
 

In the connection view of TIA portal I see a lot of connection active.

Does anyone has any advise on how to solve this?

Unity version 

Image 1433

siemens CPU 1515-2-PN

Image 1429

Image 1430

Image 1431

Connection failed: get_gameObject can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.

Image 1432

+1
Under review

Please try changin in line 779 this:

if (connectionstatus == 0)
{
int ExecTime = Client.ExecTime();
// Use ThreadStatus for thread-safe logging (no Unity object access from background thread)
ThreadStatus = "S7 interface connected - time: " + ExecTime.ToString() + " ms";

Much better!
Never would have find this.
Thank you for your quick answer.