RealtimeDictionary: new issue with 2.13.2 ?
Hello, I used to clear my RealtimeDictionary this way in version 2.10.4:
while (blocks.Count > 0)
blocks.Remove(blocks.First().Key);
Where blocks is generated model from:
[RealtimeProperty(1, true, true)] private RealtimeDictionary<BlockDataRealtimeModel> _blocks;
However in version 2.13.2, RealtimeDictionary.Count seems not updated after a Remove.
Am I missing something ?
Is there a cleaner way to clear a RealtimeDictionary ?
4 Replies
Hi @Ced. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Thank you for your question about RealtimeDictionary in NormalVR. It seems there might be a change in behavior between versions 2.10.4 and 2.13.2. Let's address your concerns based on the available information.
Regarding the issue with
RealtimeDictionary.Count
not updating after a Remove
operation in version 2.13.2, the knowledge sources don't provide specific information about this change. However, this could indeed be a new issue or a change in behavior in the newer version.
As for clearing a RealtimeDictionary, there isn't a direct "Clear" method mentioned in the documentation. However, based on the RealtimeDictionary documentation, there are a couple of approaches you could try:
1. Use the Remove
method in a loop, but instead of relying on Count
, you could use the ContainsKey
method:
2. Alternatively, you could create a temporary list of keys and then remove them:
These approaches should work regardless of whether Count
is updating correctly or not.
If you're still experiencing issues with these methods, it might be worth reporting this as a potential bug to the NormalVR team, especially if the behavior has changed between versions.
For the most up-to-date and accurate information, I recommend checking the Normcore documentation or reaching out to their support channels directly.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@308688372774469632> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Hey, thanks for reporting this bug. I'll investigate
I tried to repro using this test script:
But no luck
Could you send a repro project?
My guess would be something outside the Remove loop is playing a role and it's missing from my test script
Thx for your answer, unfortunately I'm late in my work ^^
I won't have the time to make a repro project until the end of the week