How do I create an .npmdef with the scripts of a project to use it in another project?

I’m trying to setup a multi scene project, but the different scenes include not only meshes and common behaviours but also custom components scripted for those scenes, how can I set up something like the multi scene example but also including code made on each project? I guess I should first ask if there’s a correct way to do this but the npm includes make me think this is the way. (when talking about projects I mean Unity scenes)

Original Post on Discord

by user 262331051802755072

You would need to put the custom scripts in npmdefs and reference them in your root project scene / exportinfo. Its currently not possible to have scripts be dynamically discovered (e.g. by loading a scene with new components). They must be registered from the beginning even it you dynamically load the scenes later that make use of them

Dynamically loading new components might be something we will add later but we havent made a concrete design/plan for it yet (because it also has some security implications - how do you prevent malicious code to be loaded and run on your website - thats something that you dont want to happen)