xulipa
xulipa2w ago

Multiple Realtime Manager

Can you use multiple realtime managers in a scene, so disabling one before activating the 2nd one? As I'm using two different avatar rigs and I want to change between them
5 Replies
kapa.ai
kapa.ai2w ago
Hi @xulipa. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, you can use multiple Realtime instances in a scene, which would allow you to switch between different avatar rigs. However, there are some important considerations to keep in mind: 1. Multiple Realtime Instances: Normcore supports having multiple Realtime instances in the same scene. This is mentioned in the Realtime documentation: "If you would like to use multiple rooms in your multiplayer project, you can do so by creating additional Realtime instances." 2. RealtimeView Configuration: When using multiple Realtime instances, you need to manually specify which Realtime instance each RealtimeView should use. This is done through the "Realtime Instance" field in the RealtimeView's Advanced Settings. The RealtimeView documentation states: "Most apps will only have a single instance of Realtime in a scene, and RealtimeView will automatically populate this variable using that instance. However, if you plan to have multiple instances in the same scene, you may manually wire up which instance this RealtimeView should use." 3. Switching Between Avatars: To switch between different avatar rigs, you would need to: - Disable the RealtimeAvatarManager component on the first Realtime instance - Enable the RealtimeAvatarManager component on the second Realtime instance - Ensure that each avatar rig's RealtimeView components are configured to use the correct Realtime instance However, it's important to note that the knowledge sources don't provide specific information about dynamically switching between multiple avatar rigs at runtime. This approach might lead to unexpected behavior or synchronization issues. A potentially safer alternative would be to use a single Realtime instance and implement a custom system for switching between different avatar prefabs. This could be done by modifying the localAvatarPrefab property of the RealtimeAvatarManager at runtime, as mentioned in the Avatars documentation: "If you would like to use a different avatar prefab for different clients, this property can be changed at runtime from your own scripts." This approach would allow you to switch avatar rigs without needing to manage multiple Realtime instances. Given the complexity of this setup, I recommend carefully testing any implementation to ensure proper synchronization and avoid potential issues with ownership or network state. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@725231244169707600> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
xulipa
xulipaOP2w ago
@Normcore Assistant How about attaching the realtime avatar manager onto the rigs themselves? And then just disabling/enabling the rigs?
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- While your idea is creative, it's not recommended to attach the RealtimeAvatarManager directly to the avatar rigs themselves. Here's why: 1. RealtimeAvatarManager Purpose: The RealtimeAvatarManager is designed to manage all avatars in a room, not just a single avatar. According to the Avatars documentation: "RealtimeAvatarManager is a component that lives in the scene on the same game object as your Realtime instance. It is responsible for instantiating an avatar prefab to represent the local player as well as keeping track of avatars that were instantiated for other players in the same room." 2. Realtime Instance Relationship: The RealtimeAvatarManager is meant to be on the same GameObject as the Realtime instance. Separating them could lead to unexpected behavior. 3. Avatar Instantiation: The RealtimeAvatarManager is responsible for instantiating the avatar prefabs. If you attach it to the rig itself, it would create a circular dependency where the manager is trying to instantiate the object it's already attached to. 4. Networking Considerations: Enabling and disabling entire rigs with RealtimeAvatarManagers attached could lead to networking issues, as it might interfere with the proper connection and disconnection logic that Normcore handles internally. Instead of this approach, I would recommend sticking with a single RealtimeAvatarManager and implementing a custom solution for switching between different avatar rigs. Here's a suggestion based on the information from the Avatars documentation: 1. Keep a single RealtimeAvatarManager in your scene, attached to the Realtime instance. 2. Create a script to manage your different avatar rigs. 3. Use the localAvatarPrefab property of RealtimeAvatarManager to switch between different avatar prefabs: "If you would like to use a different avatar prefab for different clients, this property can be changed at runtime from your own scripts." 4. When you want to switch avatars, destroy the current avatar instance and change the localAvatarPrefab to the new avatar prefab you want to use. This approach allows you to switch between different avatar rigs while maintaining the proper structure that Normcore expects, which should lead to fewer synchronization issues and a more stable multiplayer experience. Remember to thoroughly test your implementation to ensure smooth transitions between avatars and proper network synchronization. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@725231244169707600> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?