TNet 3  3.0.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros
TNet.TNAutoSync Class Reference

This script makes it really easy to sync some value across all connected clients. Keep in mind that this script should ideally only be used for rapid prototyping. It's still better to create custom to-the-point sync scripts as they will yield better performance. More...

Inheritance diagram for TNet.TNAutoSync:
TNet.TNBehaviour

Classes

class  SavedEntry
 

Public Member Functions

void Sync ()
 Immediately synchronize all data by sending current values to everyone else. More...
 
- Public Member Functions inherited from TNet.TNBehaviour
Get< T > (string name)
 Get the object-specific data. More...
 
Get< T > (string name, T defVal)
 Get the object-specific data. More...
 
void Set (string name, object val)
 Set the object-specific data. More...
 
void Set (string text)
 Convenience function to set the data using a single string notation such as "key = value". More...
 
virtual void DestroySelf ()
 Destroy this game object. More...
 
void DestroySelf (float delay, bool onlyIfOwner=true)
 Destroy this game object on all connected clients and remove it from the server. More...
 
void Instantiate (int rccID, string path, bool persistent, params object[] objs)
 Convenience method mirroring TNManager.Instantiate. Instantiate a new game object in the behaviour's channel on all connected players. More...
 
void Instantiate (string funcName, string path, bool persistent, params object[] objs)
 Convenience method mirroring TNManager.Instantiate. Instantiate a new game object in the behaviour's channel on all connected players. More...
 
void RemoveAllSavedRFCs ()
 Immediately remove all saved RFCs. Use this if you want to clear all saved RFCs for any reason. More...
 

Public Attributes

System.Collections.Generic.List
< SavedEntry
entries = new System.Collections.Generic.List<SavedEntry>()
 Serialized synchronized entries. More...
 
float updatesPerSecond = 10f
 Maximum possible number of updates per second. If the values don't change, nothing will be sent. If to set it to zero, the value will only be synchronized when new players join. More...
 
bool isSavedOnServer = true
 Whether the result will be saved on the server or not. In most cases it should remain as 'true'. In any case the values will be sent to newly joined players automatically. More...
 
bool isImportant = true
 Whether to send through UDP or TCP. If it's important, TCP will be used. If not, UDP. If you have a lot of frequent updates, leave it as not important. More...
 
bool onlyOwnerCanSync = true
 Whether only the object's owner can send sync messages. In most cases it should remain as 'true'. More...
 
- Public Attributes inherited from TNet.TNBehaviour
bool ignoreMissingTNO = false
 

Protected Member Functions

override void Awake ()
 Locate the property that we should be synchronizing. More...
 
void OnEnable ()
 
void OnDisable ()
 
- Protected Member Functions inherited from TNet.TNBehaviour
virtual void Start ()
 Create the TNObject if it hasn't been found already. More...
 
void CreateTNObject ()
 Create the TNObject. More...
 

Additional Inherited Members

- Properties inherited from TNet.TNBehaviour
TNObject tno [get]
 

Detailed Description

This script makes it really easy to sync some value across all connected clients. Keep in mind that this script should ideally only be used for rapid prototyping. It's still better to create custom to-the-point sync scripts as they will yield better performance.

Member Function Documentation

override void TNet.TNAutoSync.Awake ( )
protectedvirtual

Locate the property that we should be synchronizing.

Reimplemented from TNet.TNBehaviour.

void TNet.TNAutoSync.OnDisable ( )
protected
void TNet.TNAutoSync.OnEnable ( )
protected
void TNet.TNAutoSync.Sync ( )

Immediately synchronize all data by sending current values to everyone else.

Member Data Documentation

System.Collections.Generic.List<SavedEntry> TNet.TNAutoSync.entries = new System.Collections.Generic.List<SavedEntry>()

Serialized synchronized entries.

bool TNet.TNAutoSync.isImportant = true

Whether to send through UDP or TCP. If it's important, TCP will be used. If not, UDP. If you have a lot of frequent updates, leave it as not important.

bool TNet.TNAutoSync.isSavedOnServer = true

Whether the result will be saved on the server or not. In most cases it should remain as 'true'. In any case the values will be sent to newly joined players automatically.

bool TNet.TNAutoSync.onlyOwnerCanSync = true

Whether only the object's owner can send sync messages. In most cases it should remain as 'true'.

float TNet.TNAutoSync.updatesPerSecond = 10f

Maximum possible number of updates per second. If the values don't change, nothing will be sent. If to set it to zero, the value will only be synchronized when new players join.


The documentation for this class was generated from the following file: