Core Objects
목차
Tick Engine Settings
Project global settings that are stored in a ScriptableObject. You can find these in the Window menu.
Settings can be found in the menu:
Window > Photon Unity Networking > Tick Engine Settings
- Enable Tick Engine - For testing purposes only. When disabled all callbacks from the NetMaster are stopped, effectively disabling all Simple code.
- Send When Solo - Allows Simple to send updates from owned objects even when no other players are in the room. Default is enabled.
- Show GUI Headers - Toggle the large graphic headers in the inspector for Simple components.
Time Manager
Fixed Timestep
This is the same reference used in Unity's Time settings. This adjusts the PhysX simulation rate, which affects the FixedUpdate rate.
Ring Buffer
Send Every X Tick
SimpleSync uses FixedUpdate as its primary tick but can produce a network rate that is a subdivision of the fixed time rate. For example the default Unity physics fixedDeltaTime is .02 secs (50 ticks per sec). Setting Send Every X to 3 would result in a net rate of .06 (16.7 ticks per second) which is 1/3rd of the physics rate, resulting in 1/3rd the traffic.
Buffer Correction
- Manual - Set values by hand.
- Auto - Values are set based on fixedDeltaTime and SendEveryX values.
Frame Count
The number of frames allocated to the ring buffer. The more frames, the greater the memory footprint but the longer the buffer. Values that result in a buffer total of 1-2 seconds is recommended.
Target Buffer Size
The ideal number of frames that will be on the buffer at consumption time (OnSnapshot). The closer to zero the lower the latency. However too low and the buffer will become more prone to under-run.
Buffer Min/Max
The values at which the buffer will be considered in need of a size adjustment.
Ticks Before Grow/Shrink
The number of ticks where the buffer exceeds the Min/Max value before an adjustment is made. Adjustments are made by either repeating a frame, or consuming multiple frames for a tick. The greater these values the less aggressively the buffer will try to resize itself. Corrections will create a visible hitch, so it is best to avoid them.
Pack Object Settings
Code Generation
Auto Generate
When enabled, the assembly will be scanned for classes with the [PackObject] attribute and generate the syncvar code needed for them to work. Disabling this will leave existing Codegen in place but new codegen will not be created until it is re-enabled.
Delete Bad Code
If a compiler error occurs in any of the generated extension scripts that script will get deleted automatically. You should always leave this option enabled.
Net Master & Net Master Late
Two singletons are created at runtime if none exist in the scene. These produce timing callbacks used by Simple NetObjects and PackObjects and are the starting point for all activity.
NetObject
This component extends PhotonView to manage all SyncObjects and PackObjects and related callbacks.
This object collects and manages all of the callback interfaces of all ISyncObject components on a gameobject, as well as any Components with the PackObject Attribute.
NetObject responds to timings generated by NetMaster, and passes them through to its SyncObjects and PackObject components via these callbacks.
NetObject requires a PhotonView, as it uses the ViewID, IsMine and various network callbacks of the PhotonView.
Skip When Empty: EXPERIMENTAL
This instructs the NetObject to not send at all, not even a heartbeat. This saves about 3 bytes per tick per object by removing heartbeat data but the side effect is some less than desirable extrapolation. This is included for edge cases where a scene may have a LOT of idle objects and some hitchy wake up behavior is worth the savings. Be sure to set your keyframe rates on children sync objects, as keyframes will force a send. Keyframe = zero will never send a keyframe. Also be aware that PUN does not initialize objects, so until an object moves, any late joiners will not see a correct position.
Ignore Non Controller Updates
Only will deserialize updates if they originate from the current Owner/Controller of this net entity. There are few use cases where anyone would want this to be unchecked.
Resimumlate Late Arrivals
If an net object update arrives too late, Simple components typically extrapolate the frame. Enabling this allows the net object to rewind to the late frame, apply its values and resimulate all following frames back to current. This is more CPU intensive but can make the net object handle network congestion more gracefully. Disabled, even reliable packets will not properly apply unless custom code is added for handling late packets.
Event Flow