【Unity3D异常】UnityException:ArgumentException: get_time can only be called from the main thread.

UnityException:ArgumentException: get_time  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.
不要在构造函数或初始化域,你可以把初始化代码移动到 Awake 或 Start 函数中。

Unity中获取物体的组件在含有回调或者委托的相关方法中被使用。可以用变量将组件现实的内容代替。

你可能感兴趣的:(Unity,unity3d,unity)