mirror of
				https://github.com/DerTyp7/defrain-shooter-unity.git
				synced 2025-10-30 21:17:09 +01:00 
			
		
		
		
	CHANGED TO MIRROR
This commit is contained in:
		
							
								
								
									
										28
									
								
								Assets/Mirror/Editor/SyncVarAttributeDrawer.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								Assets/Mirror/Editor/SyncVarAttributeDrawer.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| using UnityEditor; | ||||
| using UnityEngine; | ||||
|  | ||||
| namespace Mirror | ||||
| { | ||||
|     [CustomPropertyDrawer(typeof(SyncVarAttribute))] | ||||
|     public class SyncVarAttributeDrawer : PropertyDrawer | ||||
|     { | ||||
|         static readonly GUIContent syncVarIndicatorContent = new GUIContent("SyncVar", "This variable has been marked with the [SyncVar] attribute."); | ||||
|  | ||||
|         public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) | ||||
|         { | ||||
|             Vector2 syncVarIndicatorRect = EditorStyles.miniLabel.CalcSize(syncVarIndicatorContent); | ||||
|             float valueWidth = position.width - syncVarIndicatorRect.x; | ||||
|  | ||||
|             Rect valueRect = new Rect(position.x, position.y, valueWidth, position.height); | ||||
|             Rect labelRect = new Rect(position.x + valueWidth, position.y, syncVarIndicatorRect.x, position.height); | ||||
|  | ||||
|             EditorGUI.PropertyField(valueRect, property, label, true); | ||||
|             GUI.Label(labelRect, syncVarIndicatorContent, EditorStyles.miniLabel); | ||||
|         } | ||||
|  | ||||
|         public override float GetPropertyHeight(SerializedProperty property, GUIContent label) | ||||
|         { | ||||
|             return EditorGUI.GetPropertyHeight(property); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 DerTyp187
					DerTyp187