- Home /
Question by
CoreDLL · May 18 at 08:55 PM ·
referencereflectionsecurity
Modify private set properties.
I am creating a networking package for unity, I have a Client class that contains information about the client (connection id, ping, time online, etc). Now I need to update or change some of the variables inside the Client class at runtime (the ping as an example) from the Network Manager that takes care of all the Client class instances, but at the same time I want make sure that no one can change the data inside (by making the fields readonly). Is a good Idea to use Reflection in this case ?
Comment
Best Answer
Answer by CoreDLL · May 21 at 04:08 PM
Solved. Just use custom Assemblies and declare variables as internal. https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613060725im_/https://answers.unity.com/themes/thub/images/avi.jpg)