Killikario
Killikario2mo ago

how do i instantiate differently

there are two different realtime.instantiate methods, how would i call one instead of the other?
2 Replies
kapa.ai
kapa.ai2mo ago
Hi @Killikario. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- There are indeed two different Realtime.Instantiate methods in Normcore. Here's how you can use each of them: 1. Basic instantiation:
GameObject myObject = Realtime.Instantiate("My Object", ownedByClient: true);
GameObject myObject = Realtime.Instantiate("My Object", ownedByClient: true);
This method takes the prefab name and optional instantiation options. 2. Instantiation with position and rotation:
GameObject myObject = Realtime.Instantiate("My Object", position, rotation, options);
GameObject myObject = Realtime.Instantiate("My Object", position, rotation, options);
This method allows you to specify the position and rotation of the instantiated object in addition to the prefab name and options. The main difference between these methods is that the second one allows you to set the initial position and rotation of the instantiated object. Both methods return the fully instantiated GameObject, with all RealtimeViews and RealtimeComponents initialized and ready for use immediately. Remember that the prefab must contain a RealtimeView on the root and must be located within a Resources folder for Unity to locate it on other clients. Realtime Class Reference (https://normcore.io/documentation/reference/classes/Normal.Realtime.Realtime) When using these methods, make sure to use Realtime.Instantiate() instead of Unity's Instantiate() to ensure that the prefab is instantiated on all clients and that all RealtimeComponents are properly connected for state synchronization across the network. Support QA (https://normcore.io/documentation/guides/recipes/using-addressables) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@580413914228195328> Kapa.ai is still learning and improving, please let me know how I did by reacting below.