PhotonStreamQueue
How do I use Photon Stream Queue
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: PhotonAnimatorView.cs
Copy
85 void Awake()
86 {
87 m_PhotonView = GetComponent
88 m_StreamQueue = new PhotonStreamQueue( 120 );
89
90 m_Animator = GetComponent
91 }
File name: PhotonStreamQueue.cs
Copy
32 public PhotonStreamQueue( int sampleRate )
33 {
34 m_SampleRate = sampleRate;
35 }
File name: PhotonStreamQueue.cs
Copy
37 void BeginWritePackage()
38 {
39 //If not enough time has passed since the last sample, we don't want to write anything
40 if( Time.realtimeSinceStartup < m_LastSampleTime + 1f / m_SampleRate )
41 {
42 m_IsWriting = false;
43 return;
44 }
45
46 if( m_SampleCount == 1 )
47 {
48 m_ObjectsPerSample = m_Objects.Count;
49 //Debug.Log( "Setting m_ObjectsPerSample to " + m_ObjectsPerSample );
50 }
51 else if( m_SampleCount > 1 )
52 {
53 if( m_Objects.Count / m_SampleCount != m_ObjectsPerSample )
54 {
55 Debug.LogWarning( "The number of objects sent via a PhotonStreamQueue has to be the same each frame" );
56 Debug.LogWarning( "Objects in List: " + m_Objects.Count + " / Sample Count: " + m_SampleCount + " = " + ( m_Objects.Count / m_SampleCount ) + " != " + m_ObjectsPerSample );
57 }
58 }
59
60 /*if( m_SampleCount > 1 )
61 {
62 Debug.Log( "Check: " + m_Objects.Count + " / " + m_SampleCount + " = " + ( m_Objects.Count / m_SampleCount ) + " = " + m_ObjectsPerSample );
63 }*/
64
65 m_IsWriting = true;
66 m_SampleCount++;
67 m_LastSampleTime = Time.realtimeSinceStartup;
68
69 }
Download file with original file name:PhotonStreamQueue
PhotonStreamQueue 142 lượt xem
Gõ tìm kiếm nhanh...