You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 15, 2022. It is now read-only.
objectCreated should be called after the AttachedBehaviour's GameObject is Setup / Passed Start() / NetworkStart(), if not, add a callback that is at this point and rename ObjectCreated - it may just be me but I assumed this should be done by the time this is called, maybe it is a naming issue. Even more ideal would be to have something in the objectCreated callback where you could access the GO without having to typecast as this would be useful!
Actual behavior:
For the Client, I found NetworkStart is called after the objectCreated callback, leading to the AttachedBehaviour to be null.
Steps to reproduce:
Attach a Host, Make a NetworkObject (e.g. NO with Behaviour NOBehaviour)
Add Debug to the NOBehaviour NetworkStart method if(NetworkBehaviour is NOBehaviour) that outputs the AttachedBehaviour to Debug
Setup callback for objectCreated on Client
Attach a Client
In the callback, using MainThread the if(NetworkBehaviour is NOBehaviour) passes but the AttachedBahaviour is null.
Note, the Debug in the NOBehaviour NetworkStart is called after
(sorry for all the bugs)
[Optional] Discord Username:
Gwom
The text was updated successfully, but these errors were encountered:
Info from @phalasz is that the objectCreated listener is also used for the NetworkBind function, so AttachedBahaviour may not be there already. Would it be possible to ensure when the NetworkBind is added to the listeners it is put at the front, something like make a new listener, add NetworkBind, and the old listeners, hopefully ensuring that the users callbacks happen after NetworkBind does.
Either that, or add a different named listener for the NetworkBind to use, that happens before the objectCreated listener
Failing any of these, maybe re-name the listener to "objectCreating" and update the documents to state that the AttachedBehaviour maybe null if the NetworkBind has not happened, and to use the NetworkStart if you need to ensure it is a GameObject.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version Number and Operating System(s):
03/10/2018-19.53.38,04 Windows, Unity Editor 2019.2.21f1
Expected behavior:
objectCreated should be called after the AttachedBehaviour's GameObject is Setup / Passed Start() / NetworkStart(), if not, add a callback that is at this point and rename ObjectCreated - it may just be me but I assumed this should be done by the time this is called, maybe it is a naming issue. Even more ideal would be to have something in the objectCreated callback where you could access the GO without having to typecast as this would be useful!
Actual behavior:
For the Client, I found NetworkStart is called after the objectCreated callback, leading to the AttachedBehaviour to be null.
Steps to reproduce:
[Optional] Discord Username:
Gwom
The text was updated successfully, but these errors were encountered: