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:

     private void DrawHelpBox(ref Rect propertyRect, bool isOpen, float height, string helpText, string url)
     {
         if (isOpen == true)
         {
             Rect helpRect = new Rect(propertyRect.xMin, propertyRect.yMin, propertyRect.width, height - 5);
             GUI.BeginGroup(helpRect, GUI.skin.box);
             GUI.Label(new Rect(5, 5, propertyRect.width - 10, height - 30), helpText, PhotonGUI.RichLabel);
             if (GUI.Button(new Rect(5, height - 30, propertyRect.width - 10, 20), "Read more in our documentation"))
             {
                 Application.OpenURL(url);
             }
             GUI.EndGroup();

             propertyRect.y += height;
         }
     }