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:

             string[] movedFromAssetPaths)
         {
             //Reimport everything if the importer itself has been modified or added
             //.Union(deletedAssets).Union(movedAssets).Union(movedFromAssetPaths)
             bool shouldReimportAll = importedAssets.Where(s => s.EndsWith(ASSET_PATH)).FirstOrDefault() != null;

             //If we should reimport all SCML files, replace the passed in array with ALL scml project files
             if(shouldReimportAll)
             {
                 Debug.Log("Reimporting all SCML files in project...");
                 importedAssets = AssetDatabase.GetAllAssetPaths().Where(assetPath => assetPath.EndsWith(".scml")).ToArray();
             }

             foreach (var path in importedAssets)
             {
                 if (!path.EndsWith(".scml"))
                     continue;

                 ImportScml(path);
             }
         }