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:

     internal void PunRespawn()
     {
         #if DEBUG
         // debugging: in some cases, the respawn is "late". it's unclear why! just be aware of this.
         double timeDiffToRespawnTime = PhotonNetwork.time - this.TimeOfRespawn;
         if (timeDiffToRespawnTime > 0.1f) Debug.LogWarning("Spawn time is wrong by: " + timeDiffToRespawnTime + " (this is not an error. you just need to be aware of this.)");
         #endif


         // if this is called from another thread, we might want to do this in OnEnable() instead of here (depends on Invoke's implementation)
         PickupItem.DisabledPickupItems.Remove(this);
         this.TimeOfRespawn = 0;
         this.PickupIsMine = false;

         if (this.gameObject != null)
         {
             this.gameObject.SetActive(true);
         }
     }