Galacean Editor provides a powerful code editor with features such as code suggestions, third-party package imports, engine event debugging, script parameter debugging, real-time project preview, and more, helping you quickly edit and debug code.
No. | Area | Description |
---|---|---|
1 | File List | View all script files in the project |
2 | Code Editor | Edit script files with features like code highlighting, code suggestions, and code formatting |
3 | Preview Area | Preview the running effect of the current script. The rendering state of this area will refresh in real-time after saving the code |
4 | Package Management Area | Add required NPM third-party packages, such as tween.js |
5 | Event Debugging Area | The code editor will automatically search for all events bound to the engine and display them here. You can trigger events here and configure event parameters |
5 | Console | View log information during code runtime |
For more information about the code editor, please check Code Editor.
After creating a script asset in the scene editor, double-click the script to open the code editor. Scripts in Galacean need to be written in Typescript, and new scripts are created based on built-in templates by default. Additionally, the Galacean code editor is based on Monaco, with shortcuts similar to VSCode. After modifying the script, press Ctrl/⌘ + S
to save, and the real-time preview area on the right will show the latest scene effects.
Tip: The Galacean code editor currently supports
.ts
,.gs
, and.glsl
file editing.
.ts
, .gs
, .glsl
) in the file treeThe code editor has a built-in engine corresponding to the project, which can automatically provide intelligent suggestions for engine APIs, helping you quickly implement logic based on the engine. However, in most cases, you will need to import Galacean ecosystem packages or other third-party packages to enhance functionality.
latest
version is usedTry it: Enter @galacean/engine-toolkit
in the search box, click the "Import" button, and then use import { OrbitControl } from '@galacean/engine-toolkit
in the code to import the OrbitControl
component.
The Galacean code editor provides a real-time preview feature. After saving the code, the preview area will automatically update, allowing you to quickly see the execution results of the code.
In the code editor, we provide an event debugging panel to help you quickly debug events in the scene.
JSON
format.Note, the script component must be bound to an entity to display the event list.