DrawOldObservedItem









How do I use Draw Old Observed Item
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets

Line Code Ex..
209 void DrawOldObservedItem() 1

File name: PhotonViewInspector.cs Copy
209     void DrawOldObservedItem()
210     {
211         EditorGUILayout.BeginHorizontal();
212
213         // Using a lower version then 3.4? Remove the TRUE in the next line to fix an compile error
214         string typeOfObserved = string.Empty;
215         if( m_Target.observed != null )
216         {
217             int firstBracketPos = m_Target.observed.ToString().LastIndexOf( '(' );
218             if( firstBracketPos > 0 )
219             {
220                 typeOfObserved = m_Target.observed.ToString().Substring( firstBracketPos );
221             }
222         }
223
224
225         Component componenValue = (Component)EditorGUILayout.ObjectField( "Observe: " + typeOfObserved, m_Target.observed, typeof( Component ), true );
226         if( m_Target.observed != componenValue )
227         {
228             if( m_Target.observed == null )
229             {
230                 m_Target.synchronization = ViewSynchronization.UnreliableOnChange; // if we didn't observe anything yet. use unreliable on change as default
231             }
232             if( componenValue == null )
233             {
234                 m_Target.synchronization = ViewSynchronization.Off;
235             }
236
237             m_Target.observed = componenValue;
238         }
239
240         EditorGUILayout.EndHorizontal();
241     }

DrawOldObservedItem 104 lượt xem

Gõ tìm kiếm nhanh...