UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
Content Creation
Materials
Unigine Material Library
Tutorials

Network API

Extern Network Classes

When working with external classes created when using the Network plugin, consider the following:

  • In UnigineScript instances of external classes are not automatically handled by the memory management system. You need to handle them manually.
  • It is recommended to minimize the number of created external classes instances, as they decrease performance. Instead of creating and deleting new object every frame, it is better to create its instance by the initialization and delete it by the shutdown. During the application operation you can simply reuse the same object.
  • In the network module, when instances of the NetworkAddress and SharedData classes are passed to the handlers, the script automatically takes ownership of them. After that, their instances are handled by the memory management system. Once script ownership is established, you can use class instances in application in any way: store references to instances, freely save, copy or delete them, etc — no memory leakage or double deleting will occur.
  • All copied references to the SharedState instances become invalid after receiving a message about deleting the state, or after destroySharedState function was called.
  • Internal instances of SharedData can be removed when states updates are deserialized (i.e. copied references to SharedState instances can become invalid after handling network packets).

Articles in This Section

Last update: 2017-07-03