Copying and Pasting cs Code

In cs, like in almost any computer programming language, reading data from a file can be tricky. You add extra lines of code to tell the computer what to do. Sometimes you can copy and paste these lines from other peoples’ code.

For example, you can follow the pattern in this listing:

         PhotonTransformViewPositionModel.InterpolateOptions interpolateOption)
     {
         DrawPropertyWithHelpIcon(ref propertyRect, ref this.m_InterpolateHelpOpen, interpolatePositionProperty, INTERPOLATE_TOOLTIP);
         DrawHelpBox(ref propertyRect, this.m_InterpolateHelpOpen, GetInterpolateHelpBoxHeight(), INTERPOLATE_HELP, INTERPOLATE_HELP_URL);

         switch (interpolateOption)
         {
             case PhotonTransformViewPositionModel.InterpolateOptions.FixedSpeed:
                 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.InterpolateMoveTowardsSpeed"),
                     new GUIContent("MoveTowards Speed"));
                 propertyRect.y += EDITOR_LINE_HEIGHT;
                 break;

             case PhotonTransformViewPositionModel.InterpolateOptions.Lerp:
                 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.InterpolateLerpSpeed"), new GUIContent("Lerp Speed"));
                 propertyRect.y += EDITOR_LINE_HEIGHT;
                 break;

             /*case PhotonTransformViewPositionModel.InterpolateOptions.MoveTowardsComplex:
                 Rect curveRect = new Rect(propertyRect.xMin, propertyRect.yMin, propertyRect.width - 100, propertyRect.height);
                 EditorGUI.PropertyField(curveRect, serializedObject.FindProperty("m_PositionModel.InterpolateSpeedCurve"), new GUIContent("MoveTowards Speed Curve"));

                 Rect labelRect = new Rect(propertyRect.xMax - 95, propertyRect.yMin, 10, propertyRect.height);
                 GUI.Label(labelRect, "x");

                 Rect multiplierRect = new Rect(propertyRect.xMax - 80, propertyRect.yMin, 80, propertyRect.height);
                 EditorGUI.PropertyField(multiplierRect, serializedObject.FindProperty("m_PositionModel.InterpolateMoveTowardsSpeed"), GUIContent.none);
                 propertyRect.y += EDITOR_LINE_HEIGHT;

                 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.InterpolateMoveTowardsAcceleration"),
                     new GUIContent("Acceleration"));
                 propertyRect.y += EDITOR_LINE_HEIGHT;

                 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.InterpolateMoveTowardsDeceleration"),
                     new GUIContent("Deceleration"));
                 propertyRect.y += EDITOR_LINE_HEIGHT;
                 break;*/
         }
     }