cryptomax
cryptomax2mo ago

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:
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.
Jump to solution
15 Replies
kapa.ai
kapa.ai2mo ago
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: ----------------------
kapa.ai
kapa.ai2mo ago
<@401986039964631060> kapa.ai is still learning and improving, please let us know how it did by reacting below
cryptomax
cryptomax2mo ago
yeah the documentation doesnt' cover this
Camobiwon
Camobiwon2mo ago
AFAIK this should be okay (?) as it's already registered to the realtime / datastore
cryptomax
cryptomax2mo ago
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
Camobiwon
Camobiwon2mo ago
children are off in which way? like a disabled gameobject
cryptomax
cryptomax2mo ago
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
Camobiwon
Camobiwon2mo ago
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
cryptomax
cryptomax2mo ago
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 😦
Camobiwon
Camobiwon2mo ago
what is ToggleGameObject?
cryptomax
cryptomax2mo ago
just the GO Ref
Camobiwon
Camobiwon2mo ago
ah
Solution
cryptomax
cryptomax2mo ago
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.
Camobiwon
Camobiwon2mo ago
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
cryptomax
cryptomax2mo ago
it turns on and off locally, I guess your right I didnt' actually make sure the object was working for other clients thanks 🙂