Needle Engine Project Structure
Web Project Files
|Configuration for Needle Engine builds and integrations|
|Project configuration containing name, version, dependencies and scripts|
|Typescript compiler configuration|
|Files and folders to be ignored in git|
|Contains vite specific configuration.|
It also adds the Needle Engine vite plugins.
Default Vite project structure
Our main project template uses the superfast vite bundler. The following shows the structure of the Vite template that we created and ship (altough it is possible to adapt it to your own needs).
|The asset folder contains exported assets from Unity. E.g. generated |
|(optional) - If you have custom assets that you need to reference/load add them to the include directory. On build this directory will be copied to the output folder.|
|Your project specific scripts / components|
|You can add any new folders here as you please. Make sure to copy them to the output directory when building|
|The landing- or homepage of your website|
|The vite config. Settings for building the distribution and hosting the development server are made here. It is usually not necessary to edit these settings.|
|Included from |
|You can add any new files here as you please. Make sure to copy them to the output directory when building (unless they are just being used during development)|
Learn more in the docs about bundling and usage with other frameworks
Unity Project Folders and Files
|This is where project specific/exclusive assets live.|
|This is where packages installed for this project live. A package can contain any asset type. The main difference is that it can be added to multiple Unity projects. It therefor is a great method to share code or assets. To learn more about packages see the Unity documentation about packages.|
|Needle Engine Unity Package|
|Contains all Needle Engine built-in runtime components (See |
Typescript in Unity
NPM Definition are npm packages tightly integrated into the Unity Editor.
That includes generating C# component stubs automatically. In the future, we're planning to support automatically copying assets to output/distribution folders as well.
Creating and installing a npmdef
To create a NPM Definition right click in the Unity Project browser and select
You can install a NPM Definition package to your runtime project by e.g. selecting your
Export Info component and adding it to the
dependencies list (internally this will just add the underlying npm package to your package.json).
Don't forget to install the newly added package by e.g. clicking Install on the ExportInfo component and also restart the server if it is already running
To edit the code inside a NPM Definition package just double click the asset NPM Definition asset in your project browser and it will open the vscode workspace that comes with each npmdef.
If you're planning to only add custom files via NpmDefs and not change the project config (e.g. for a quick fullscreen test), you can prefix the project path with
Library. The project will be generated in the Unity Project Library and does not need to be added to source control (the Library folder should be excluded from source control). We call these projects temporary projects. They're great for quickly testing out ideas!