Unable to read other players segments using the RawMemory component
-
My friend and I tried to set up a simple way of communication with the RawMemory component. When that didn't work I asked #help on slack and everyone was giving me similar code snippets (which all didn't work and were pretty similar to what we had done). I have been experimenting with this for a while now, but the feature just seems to be broken. I have posted one of the many code snippets down below. Any ideas/advise?
(sender side)
RawMemory.segments[0] = JSON.stringify({ "hello": "world" }); RawMemory.setPublicSegments([0]); RawMemory.setDefaultPublicSegment(0);
(receiver side)
if (RawMemory.foreignSegment != undefined) { console.log(RawMemory.foreignSegment); } else { console.log("No segment"); RawMemory.setActiveForeignSegment("HerrKai", 0); }
-
I went to get your memory you posted, it continued to display undefined on both shards your on. Not sure if that's because I've never configured RawMemory or if its just not setting for you for some reason.
On that note, if you are trying to post it on one shard and your friend trying to retrieve it on the other (window focused on Shard1 vs shard 3) then it wouldn't work afaik raw memory like normal memory is shard-specific.
Never played with rawMemory personally beyond interShard memory. So would have to play around with it to see.
-
Hey, thanks for your reply. I am actually executing this code on all shards at the same time.
Edit: If you do play around with it at some point and figure it out, feel free to reach out to me, cause I'd really like to know what the problem is. Either on this forum, slack or even via ingame message, whatever works for you.
-
Did you confirm its saving on your side as well by just looking at segment [0] from your code?
-
I tried out reading my own segments, as well as checking via the ingame gui (Memory>Segments) and the data is there, yes.
-
@herrkai Thanks for the report, I'll check it.
-
Thank you in advance!
-
@herrkai The fix is ready, it will be included in the next production update. Meanwhile, you may use any segment except 0, it should work as it is. Thank you again for reporting this edge case.
-
@o4kapuk Thank you for dealing with this so quickly! Will try
-
@o4kapuk I tried using segment 1 and it instantly worked. Thank you very much!
-
The fix is deployed, thank you again for the report.