Scripts & IDE Workflow editor only

Gameplay scripts and scene systems are native C++ that compile into the editor and the shipped game (recompile-into-target). This page covers where those files live, how to edit them in a real IDE with full engine autocomplete, and the rebuild step that makes a new script usable.

Where scripts live

Scripts live in <Project>/assets/scripts/, inside the assets tree, and appear in the Content Browser like any other content. The packer drops .h/.cpp when building the game, so source sitting there is never shipped as data.

Projects that still keep scripts in the old <Project>/scripts/ folder are migrated automatically the first time they are opened — unless both folders have files in them, in which case the editor leaves them alone rather than guess how to merge them, and logs what it skipped.

Creating a script

Content Browser ▸ right-click ▸ Code ▸ New Script generates a ScriptableEntity subclass as a single .h and opens it in the built-in code editor. New System does the same for a SceneSystem, plus a .system data asset.

There is no companion .cpp to write or maintain. The editor generates one translation unit for the whole folder, _ScriptRegistrations.cpp, that includes every script header and registers the class each one declares — picking REGISTER_SCRIPT or REGISTER_SYSTEM from the base class. A class that already registers itself is left alone, so hand-written and older scripts keep working unchanged.

The generator needs the class to be named after its file and to derive from ScriptableEntity or SceneSystem. A header it cannot register is reported by name in the Console — a skipped script would otherwise just quietly do nothing at Play.

Open the project in an IDE

Content Browser ▸ Code ▸ Open Project in IDE (also in Editor Preferences ▸ Code / IDE) detects installed IDEs — Visual Studio, VS Code, Rider, CLion, Cursor — and opens your project folder. Before opening, the editor drops an auto-generated CMakeLists.txt in the project that add_subdirectory()s the engine, so the IDE resolves engine methods and overloads — full go-to-definition into engine sources, alongside your scripts.

  • Engine-only configure (editor/hub/tests skipped) to keep the IDE model lean.
  • Reuses the existing build's downloaded dependencies, so the first configure doesn't re-clone.
  • Never overwrites a hand-written CMakeLists.txt — only its own generated one.

The IDE editor used for opening individual files is configurable in Preferences (or falls back to the built-in code editor). Creating a script never launches an external editor.

Rebuilding

After adding or editing scripts, press F6. That mirrors the project's scripts into the editor's staging folder, regenerates the registrations, recompiles only the gameplay script module, and reloads it — the editor keeps running and your scene stays open.

When the build fails, the notification leads with the compiler's own error line and opens the Build Console, which holds the full output.

The path in a compiler error points at the editor's staging copy of your script, which is wiped and rewritten on every sync — so fix the file of that name in your project's scripts folder, not the one the path names. The notification shows the filename alone for exactly this reason.

Editing engine or editor C++ is a different matter: that needs the executable relinked, which Windows will not do while it is running. Rebuild Editor and Restart, next to Rebuild Scripts in the same menu, does the save-build-restart for you.

See also

Native Scripting · Scene Systems · ScriptableEntity

Skrypty i IDE tylko edytor

Skrypty gry i systemy sceny to natywny C++ kompilowany do edytora i do wydanej gry (rekompilacja do celu). Ta strona opisuje, gdzie te pliki leżą, jak edytować je w prawdziwym IDE z pełnym podpowiadaniem silnika i jaki krok przebudowy sprawia, że nowy skrypt da się użyć.

Gdzie są skrypty

Skrypty leżą w <Projekt>/assets/scripts/, w drzewie assetów, i widać je w Content Browserze jak każdą inną zawartość. Packer pomija .h/.cpp przy budowaniu gry, więc leżące tam źródła nigdy nie są wysyłane jako dane.

Projekty, które wciąż trzymają skrypty w starym folderze <Projekt>/scripts/, są przenoszone automatycznie przy pierwszym otwarciu — chyba że oba foldery zawierają pliki; wtedy edytor ich nie rusza, zamiast zgadywać, jak je połączyć, i zapisuje w logu, co pominął.

Tworzenie skryptu

Content Browser ▸ prawy klik ▸ Code ▸ New Script generuje podklasę ScriptableEntity jako jeden plik .h i otwiera ją we wbudowanym edytorze kodu. New System robi to samo dla SceneSystem, plus asset danych .system. New Editor Window tworzy narzędzie edytora — zob. Okna edytora.

Nie ma towarzyszącego .cpp do pisania ani utrzymywania. Edytor generuje jedną jednostkę kompilacji dla całego folderu, _ScriptRegistrations.cpp, która dołącza każdy nagłówek skryptu i rejestruje zadeklarowaną w nim klasę — wybierając REGISTER_SCRIPT albo REGISTER_SYSTEM po klasie bazowej. Klasa, która rejestruje się sama, zostaje bez zmian, więc skrypty pisane ręcznie i starsze działają dalej.

Generator wymaga, żeby klasa nazywała się jak jej plik i dziedziczyła po ScriptableEntity albo SceneSystem. Nagłówek, którego nie potrafi zarejestrować, jest wymieniany z nazwy w konsoli — pominięty skrypt inaczej po prostu po cichu nic by nie robił podczas Play.

Otwieranie projektu w IDE

Content Browser ▸ Code ▸ Open Project in IDE (także w Editor Preferences ▸ Code / IDE) wykrywa zainstalowane IDE — Visual Studio, VS Code, Rider, CLion, Cursor — i otwiera folder projektu. Przed otwarciem edytor kładzie w projekcie wygenerowany CMakeLists.txt, który robi add_subdirectory() silnika, więc IDE rozwiązuje metody i przeciążenia silnika — pełne „przejdź do definicji” w źródłach silnika obok twoich skryptów.

  • Konfiguracja samego silnika (edytor/hub/testy pominięte), żeby model IDE był lekki.
  • Używa zależności pobranych przez istniejący build, więc pierwsza konfiguracja nie klonuje ich ponownie.
  • Nigdy nie nadpisuje ręcznie napisanego CMakeLists.txt — tylko swój wygenerowany.

IDE do otwierania pojedynczych plików ustawisz w Preferences (albo zostaje wbudowany edytor kodu). Utworzenie skryptu nigdy nie uruchamia zewnętrznego edytora.

Przebudowa

Po dodaniu lub zmianie skryptów naciśnij F6. To kopiuje skrypty projektu do folderu roboczego edytora, generuje rejestracje, kompiluje tylko moduł skryptów gry i go przeładowuje — edytor dalej działa, a scena zostaje otwarta.

Gdy build się nie uda, powiadomienie zaczyna się od linii błędu kompilatora i otwiera Build Console z pełnym wyjściem.

Ścieżka w błędzie kompilatora wskazuje kopię roboczą twojego skryptu w edytorze, która jest czyszczona i zapisywana od nowa przy każdej synchronizacji — więc poprawiaj plik o tej nazwie w folderze skryptów projektu, a nie ten wskazany ścieżką. Dlatego powiadomienie pokazuje samą nazwę pliku.

Zmiana C++ silnika lub edytora to inna sprawa: wymaga ponownego zlinkowania pliku wykonywalnego, czego Windows nie zrobi, gdy ten działa. Project ▸ Rebuild Editor and Restart, obok Rebuild Scripts w tym samym menu, robi zapis-build-restart za ciebie.

Zobacz też

Skrypty natywne · Systemy sceny · ScriptableEntity