Partial class or no? Mybe a mistake in documentation but idk
Hi,
This script in the image did not work.
I asked my friend GTP and it works when the StopwatchModel is a public partial class instead of a public class.
I don't know why? but it is.
So wanted to post it here to be sure that it isnt a mistake.
7 Replies
Hi @Mikameel. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
You're absolutely correct, and thank you for bringing this to our attention. The
StopwatchModel
class should indeed be declared as a public partial class
. This is not a mistake in your implementation, but rather an oversight in the documentation.
According to the RealtimeModel documentation, RealtimeModel classes need to be declared as partial:
"Models also need to be partial
classes so that Normcore can supplement the class with the networking code."
The correct declaration should be:
This allows Normcore to generate additional code for the model, which is crucial for its proper functioning within the Normcore framework.
It's worth noting that in Unity 2021 and newer versions, Normcore automatically generates the remaining code needed to use your model, even if you don't see it in your file. The extra code exists as temporary C# code generated when your project compiles.
For older Unity versions (2019/2020), you would need to manually compile the model in the Unity editor by highlighting the class and clicking "Compile Model".
Thank you for catching this discrepancy. It's a valuable reminder of the importance of using partial
classes when working with RealtimeModels in Normcore.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@365574199844274177> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
hooray bingo
ah yeah it used to be fine without
partial
but now we required it. @NormalMark do you want to write up a quick linear issue to audit our docs site examples for this bug?this bot is amazingly fast and good
Can I use it as my project help? or is it only for issues etc?
For instance I want to have a networked video synced. Can I ask it to write a tutorial for this based on your latest documenation?
it's only trained on our docs so I don't know if it will be able to go that far, but you could try it. it's worth noting you may want to use something like Agora for real-time video sync
Normcore is great for synchronization of playback of video assets, but if you need like camera streaming you'll want to check out LiveKit or Agora
aaah okay thanks! I also have a look at that. For now i'm looking for .mp4 streams but later live streams so thanks for that!