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:

     protected virtual void OnGUI()
     {
         PhotonSetupStates oldGuiState = this.photonSetupState; // used to fix an annoying Editor input field issue: wont refresh until focus is changed.

         GUI.SetNextControlName("");
         this.scrollPos = GUILayout.BeginScrollView(this.scrollPos);

         if (this.guiState == GUIState.Uninitialized)
         {
             this.ReApplySettingsToWindow();
             this.guiState = (PhotonEditor.Current.HostType == ServerSettings.HostingOption.NotSet) ? GUIState.Setup : GUIState.Main;
         }

         if (this.guiState == GUIState.Main)
         {
             this.OnGuiMainWizard();
         }
         else
         {
             this.OnGuiRegisterCloudApp();
         }

         GUILayout.EndScrollView();

         if (oldGuiState != this.photonSetupState)
         {
             GUI.FocusControl("");
         }
     }