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
With the Entity Outliner view pane visible, left-click the entity that you want to add a Lua script to.
Click Add Component, in the
Scriptingcategory of the drop-down menu, select Lua Script.
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.Note:You can select either a
.luafile (a text copy of the original), or a
.luacfile (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
.luafiles if you experience any issues.
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.
The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Policy page.