点击Register/Login 报错 NullReferenceException
simonzg opened this issue · 4 comments
simonzg commented
把服务器跑起来之后,显示 All services are ready!
然后再运行unity工程,使用Login这个Scene,填入用户名和密码后报错NullReferenceException:
NullReferenceException: Object reference not set to an instance of an object
Login.OnRegister () (at Assets/GoWorld/DemoScripts/Login.cs:39)
UnityEngine.Events.InvokableCall.Invoke (System.Object[] args) (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:154)
UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:637)
UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:773)
UnityEngine.Events.UnityEvent.Invoke () (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:52)
UnityEngine.UI.Button.Press () (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:36)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:45)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at /Users/builduser/buildslave/un
看起来像是goWorldManager的player没有初始化,是null,不知道应该怎么改,请赐教
luochuanyuewu commented
你看看对应脚本是否附加到游戏对象上了,如果附加了 你再看看是否有些公开引用没有在inspector指定。
simonzg commented
感谢回复!
其实我想确认的是,我把这个demo在unity里面载入之后,不是直接使用Login这个scene就可以运行?需要自己加游戏对象?
xiaonanln commented
请在goworld.ini配置文件里确保设置compress_connection=0,因为目前客户端demo还不支持通信数据压缩
simonzg commented
我确认在我这边改了配置 compress_connection=0 之后,问题消除,非常感谢!!