Open James-Frowen opened 3 months ago
example use
public static void WriteMission(this NetworkWriter finalWriter, Mission mission)
{
var writer = finalWriter;
var stringStore = new StringStore();
var writer = new NetworkWriter(64_000, true);
writer.StringStore = stringStore;
// write large message with lots of strings here
// ...
// write strings then large message
finalWriter.WriteStringStore(stringStore);
finalWriter.WriteBytesAndSizeSegment(writer.ToArraySegment());
}
public static Mission ReadMission(this NetworkReader finalReader)
{
// read strings, then set it on the inner reader
var stringStore = finalReader.ReadStringStore();
var reader = new NetworkReader();
reader.Reset(finalReader.ReadBytesAndSizeSegment());
reader.StringStore = stringStore;
// read large message, reader will use the stringStore we read above
// ...
}
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.
will save bandwidth when sending many strings that are the same
This works, but requires test and a better way to use it before merging