mstfmrt07
mstfmrt072w ago

What is the best way to get the exact time a room is created?

Is there a way to find the room start time?
4 Replies
kapa.ai
kapa.ai2w ago
Hi @mstfmrt07. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but based on the provided knowledge sources, there doesn't seem to be a direct way to get the exact time a room is created in NormalVR. The Room class in Normcore provides a time property, but this represents the server time on the current frame, not the creation time of the room. However, you could potentially use a workaround by creating a RealtimeComponent that records the server time when it is first instantiated. This would give you a rough approximation of when the room was created, as RealtimeComponents are initialized when the room is connected. Here's a simple example of how you might do this:
using Normal.Realtime;

public class RoomCreationTime : RealtimeComponent {
private double _creationTime;

private void Start() {
_creationTime = realtime.room.time;
}

public double GetCreationTime() {
return _creationTime;
}
}
using Normal.Realtime;

public class RoomCreationTime : RealtimeComponent {
private double _creationTime;

private void Start() {
_creationTime = realtime.room.time;
}

public double GetCreationTime() {
return _creationTime;
}
}
In this example, RoomCreationTime is a RealtimeComponent that records the server time in its Start method. You can then use the GetCreationTime method to retrieve this time later. Please note that this is just a workaround and may not give you the exact creation time of the room, especially if there is a delay between when the room is created and when the RealtimeComponent is initialized. For more accurate results, you might need to modify the server code or use a different method that isn't covered in the provided knowledge sources. Sources: - Room Class (https://normcore.io/documentation/reference/classes/Normal.Realtime.Room) - RealtimeComponent Class (https://normcore.io/documentation/reference/classes/Normal.Realtime.RealtimeComponent%601) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@208292457979314176> kapa.ai is still learning and improving, please let us know how it did by reacting below
Mechabit
Mechabit2w ago
if you run that code during the OnModelReplaced event and isFreshModel == true then only the first player will set the time so late joiners wont override it
mstfmrt07
mstfmrt072w ago
Thanks a lot! It worked as expected ❤️
More Posts
Bandwidth usage analysisI wanted to analyze my application's bandwidth usage more thoroughly to see if I'm sending unnecessaAllow RealtimeView.realtime and RealtimeView.viewUUID to be set from the editor inside prefabsWe have a use case where we want to be able to dynamically spawn a normcore room from a prefab. UnfoRealtime.Destroy On owned realtime prefabs.Can I destroy a RealtimePrefab by calling Realtime.Destroy even if someone else is an owner? Or do IHow can I distort the mic audio in RealtimeAvatarVoice to be higher or lower pitch?Is it possible to distort the mic audio from RealtimeAvatarVoice so the player is heard with a squeaAre there any best practices for syncing a large number of variables in one script?For instance if we have a large script with many bools floats, integers etc and they all need to be First player isn't synced to other players, while other players are visible to the first playerNo idea why this started happening - didn't change any code from what I can tell, but now whenever aReadStream was expecting to read a Null type from the stream, but was asked to read a Model typeI started getting this error in my game when I started disconnecting from it by closing the app. My Show the property path for RealtimeSet delta update errorsSometimes I'll get an error from normcore like `RealtimeSet received delta update for non-existent kHow can I disconnect another player from the gameI need to disconnect a player with another player. Can I do that?Delayed room updatesWe were in the process of testing our game with roughly 18 people per room, and we noticed that data