SetLayerSynchronized
How do I use Set Layer Synchronized
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
83 | this.m_Target.SetLayerSynchronized(i, PhotonAnimatorView.SynchronizeType.Disabled); | 1 |
189 | public void SetLayerSynchronized( int layerIndex, SynchronizeType synchronizeType ) | 2 |
File name: PhotonAnimatorViewEditor.cs
Copy
66 private void DrawWeightInspector()
67 {
68 SerializedProperty foldoutProperty = serializedObject.FindProperty("ShowLayerWeightsInspector");
69 foldoutProperty.boolValue = PhotonGUI.ContainerHeaderFoldout("Synchronize Layer Weights", foldoutProperty.boolValue);
70
71 if (foldoutProperty.boolValue == false)
72 {
73 return;
74 }
75
76 float lineHeight = 20;
77 Rect containerRect = PhotonGUI.ContainerBody(this.m_Animator.layerCount*lineHeight);
78
79 for (int i = 0; i < this.m_Animator.layerCount; ++i)
80 {
81 if (this.m_Target.DoesLayerSynchronizeTypeExist(i) == false)
82 {
83 this.m_Target.SetLayerSynchronized(i, PhotonAnimatorView.SynchronizeType.Disabled);
84 EditorUtility.SetDirty(this.m_Target);
85 }
86
87 PhotonAnimatorView.SynchronizeType value = this.m_Target.GetLayerSynchronizeType(i);
88
89 Rect elementRect = new Rect(containerRect.xMin, containerRect.yMin + i*lineHeight, containerRect.width, lineHeight);
90
91 Rect labelRect = new Rect(elementRect.xMin + 5, elementRect.yMin + 2, EditorGUIUtility.labelWidth - 5, elementRect.height);
92 GUI.Label(labelRect, "Layer " + i);
93
94 Rect popupRect = new Rect(elementRect.xMin + EditorGUIUtility.labelWidth, elementRect.yMin + 2, elementRect.width - EditorGUIUtility.labelWidth - 5, EditorGUIUtility.singleLineHeight);
95 value = (PhotonAnimatorView.SynchronizeType) EditorGUI.EnumPopup(popupRect, value);
96
97 if (i < this.m_Animator.layerCount - 1)
98 {
99 Rect splitterRect = new Rect(elementRect.xMin + 2, elementRect.yMax, elementRect.width - 4, 1);
100 PhotonGUI.DrawSplitter(splitterRect);
101 }
102
103 if (value != this.m_Target.GetLayerSynchronizeType(i))
104 {
105 Undo.RecordObject(target, "Modify Synchronize Layer Weights");
106 this.m_Target.SetLayerSynchronized(i, value);
107
108 EditorUtility.SetDirty(this.m_Target);
109 }
110 }
111 }
File name: PhotonAnimatorView.cs
Copy
189 public void SetLayerSynchronized( int layerIndex, SynchronizeType synchronizeType )
190 {
191 if( Application.isPlaying == true )
192 {
193 m_WasSynchronizeTypeChanged = true;
194 }
195
196 int index = m_SynchronizeLayers.FindIndex( item => item.LayerIndex == layerIndex );
197
198 if( index == -1 )
199 {
200 m_SynchronizeLayers.Add( new SynchronizedLayer { LayerIndex = layerIndex, SynchronizeType = synchronizeType } );
201 }
202 else
203 {
204 m_SynchronizeLayers[ index ].SynchronizeType = synchronizeType;
205 }
206 }
SetLayerSynchronized 105 lượt xem
Gõ tìm kiếm nhanh...