Adding Lua Scripts to Component Entities

O3DE makes it easy for you to add script functionality to your game entities by using the Lua Script component. The following steps show you how to do this in O3DE Editor.

To add a Lua script to a component entity in O3DE Editor

  1. With the Entity Outliner view pane visible, left-click the entity that you want to add a Lua script to.

  2. Click Add Component, in the Scripting category of the drop-down menu, select Lua Script.

    Lua Script component

  3. A Lua Script component appears in Entity Inspector. Use the Browse Directory button to select the Lua script from the file hierarchy that you want to use.

    Browse directory for Lua script

    You can select either a .lua file (a text copy of the original), or a .luac file (a precompiled version of the script). The functionality should be the same. The precompiled version is preferable because it loads faster and is usually smaller. However, you can use.lua files if you experience any issues.
  4. After the script is loaded, click Open in Lua Editor to launch the Lua Editor and make changes to your script.

Copyright © 2022 Open 3D Engine Contributors

Documentation Distributed under CC BY 4.0.
For our trademark, privacy and antitrust policies, code of conduct, and terms of use, please click the applicable link below or see

The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Policy page.