Scripts in Core

Scripts in Core are like Core Objects or templates. In this lesson you will learn some of the suprising aspects of how scripts work in Core, and how to create them.

Finding Your Scripts

Create Script

To create a script, click the Script button in the top toolbar and select Create New Script.

The Script Generator

The script generator will give you code for a few specific common uses, and is extremely valuable when you need a reminder of how the code should look.

Project Content

Once you created a script, you can find it in the Project Content window, in the Scripts tab. If you want the script to run when you start the game, you will need to drag it from here into the Hierarchy.

Find the Files

Creating a script creates a new .lua file in a Scripts folder of your project directory.

To find these scripts on your computer:

  1. Open up the Windows File Explorer and find your Documents folder.
  2. In Documents, open the My Games folder.
  3. Open the CORE folder.
  4. Open the Saved folder.
  5. Open the Maps folder. All your individual projects should have their own folders here.
  6. Open the folder named after the project you are working on and find its Scripts folder.

Inside here you should see .lua files for each of your scripts, and .asset files that let Core treat them like an object.

Script References and Duplication

When you move or duplicate scripts in Core, this does not change the script file. Instead, it creates more references to that script.

This allows you more control from a coder perspective, by not having assets that use many different but similar scripts, but can be confusing.

Even if you select Duplicate in the Scripts folder of Project Content, you are essentially creating another arrow that points back to the same script. Any changes made to the duplicate just change the original file.

You can even change the name of the script in the Hierarchy, and it will still refer to the same script, with the name you gave it originally.

How to Truly Copy a Script

If you truly want to copy a script, make a new script, and copy and paste the code into it.

Conclusion

You should now have a better idea of where scripts are, and how Core manages references to them. In the next lesson, you will learn how to get references game objects in your scripts, to be able to modify and

Scroll to Top