Disabling object with realtime view?
I see you aren't supposed to start with a disabled view but what about disabling and reenabling a realtime view during runtime after that?
Solution:Jump to solution
eh ok I found the issue it was getting disabled elsewhere. So I guess it's fine to enable and disable them as long as it's after they are registered.
15 Replies
Hi @cryptomax. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The documentation does not explicitly mention the ability to disable and re-enable a RealtimeView during runtime. However, it does state that if RealtimeViews are disabled, they will not register with Realtime in
Start()
, and Realtime will neither initialize them nor connect them to the datastore.
Instead of disabling the RealtimeView, you can use a custom RealtimeComponent to enable/disable child game objects, scripts, or renderers directly. This approach allows you to control the active state of specific elements without affecting the RealtimeView's connection to the datastore.
For more information, please refer to the documentation (https://normcore.io/documentation/realtime/common-questions#can-i-disable-realtimeview).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@401986039964631060> kapa.ai is still learning and improving, please let us know how it did by reacting below
yeah the documentation doesnt' cover this
AFAIK this should be okay (?) as it's already registered to the realtime / datastore
well I have an object with transform and view, components and RB. I'm enabling and disabling during runtime using a RT component to flip it on and off and it is disabling all children even though i'm just doing a ToggleGameObject.SetActive
on reenable after disabling, the children are all off (it didn't maintain their active state) so I wondered if it's somethign to do with the realtime
children are off in which way? like a disabled gameobject
yeah like the parent is getting turned on but with all it's children off, even though they were all active when it was disabled
sounds like a bug in code somewhere, realtimeview never touches gameobject active state I don't believe
if you recursively disabled all objects, then enabling the parent object would still have all the children disabled
eh yeah i'm not just a single object ref and toggling it's active state based on a component int but I guess I gotta keep poking around as to why the children are getting disabled 😦
what is ToggleGameObject?
just the GO Ref
ah
Solution
eh ok I found the issue it was getting disabled elsewhere. So I guess it's fine to enable and disable them as long as it's after they are registered.
I believe so? Untested and unsure, but at least fundamentally it makes sense since it's registered, has callbacks / events assigned, and what not
Data I believe can still be sent and received since it's not run on the update loop
it turns on and off locally, I guess your right I didnt' actually make sure the object was working for other clients
thanks 🙂