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 static void OnUpdate()
{
// after a compile, check RPCs to create a cache-list
if (!postCompileActionsDone && !EditorApplication.isCompiling && !EditorApplication.isPlayingOrWillChangePlaymode && PhotonEditor.Current != null)
{
#if UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_1 || UNITY_5_2
if (EditorApplication.isUpdating) return;
#endif
PhotonEditor.UpdateRpcList();
postCompileActionsDone = true; // on compile, this falls back to false (without actively doing anything)
#if UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_1 || UNITY_5_2
PhotonEditor.ImportWin8Support();
#endif
}
}
{
// after a compile, check RPCs to create a cache-list
if (!postCompileActionsDone && !EditorApplication.isCompiling && !EditorApplication.isPlayingOrWillChangePlaymode && PhotonEditor.Current != null)
{
#if UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_1 || UNITY_5_2
if (EditorApplication.isUpdating) return;
#endif
PhotonEditor.UpdateRpcList();
postCompileActionsDone = true; // on compile, this falls back to false (without actively doing anything)
#if UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_1 || UNITY_5_2
PhotonEditor.ImportWin8Support();
#endif
}
}