Script Generation

uScript works by converting your visual graph logic into actual C# programming code that Unity will use for your game.

 

 

Rebuilding Generated Code Files

Sometimes this code gets out of sync and will generate compile errors in Unity (usually from a uScript build upgrade that contains new features and improved nodes). When this happens, you need to delete/rebuild your generated scripts so they are in sync with the new uScript build and can take advantage of the new features and enhancements.

 

 

Delete Generated Files

There are two methods to delete your generated uScript code files-- through the uScript editor and manually.

 

Method 1 - Rebuild Scripts Dialog

In most cases, uScript itself will detect that it needs to rebuild your uScript's generated code files and ask if you would like to do so in a pop up dialog box. Just press the "Yes" button to have uScript delete and rebuild your generated code files.

 

 

Note! - This method will not work if nodes have been modified (updated or deleted)! In that case, please select "No" from the dialog window shown above and use the "Remove Generated Code" button (shown below).

 

Remove Generated Code Button

Also, from within the uScript Editor, you can choose to delete your generated code files at any time by pressing the "Remove Generated Code" button in the File Menu above the Canvas.

 

 

If the above methods do not work, you can always manually delete your generated code files by following the process below.

 

Method 2 - Rebuilding Scripts Manually

If all else fails, you can manually delete these files from right within Unity's Project tab. Just open up the "uScriptProjectFiles" folder and then the "uScripts" folder (note, this is different than the root "uScript" folder!). Here you will see a "_GeneratedCode" folder. Open that folder up and delete the C# files (.cs) inside. See this image for an example of where to go to delete the generated files for a uScript graph called "scrap":

 

 

Each uScript graph creates two generated C# files, one is the same name as your graph (scrap.cs in the above example) and the other is a component file (scrap_Component.cs in the above example).

 

In short, all files inside the "_GeneratedCode" folder are ok to delete. uScript can rebuild them for you from the .uscript files located in "uScriptProjectFiles/uScript". Do not delete your .uscript files as those are your actual graph files and you will loose your graphs! Just delete the generated .cs files!

 

Note! - If you have the Unity console window up, you can usually click on script compile errors there and it will highlight the file is having a problem with. This makes it easy to locate and delete these generated files.

 

Rebuilding Generated Files

There are two ways to rebuild the generated code files for your graphs.

 

Save the graph. In the uScript Editor, load the graph you wish to regenerate the code for and hit the "Save" button in the File Menu above the Canvas. uScript will always regenerate your graph's code when you hit the save button.

 

 

 

Rebuild them all at once. In the uScript Editor, press the "Rebuild All uScripts" button in the File Menu above the Canvas. This will rebuild all of your graphs code files all at once.