Custom Scripts

Hi folks,

this software looks so promising but I’m finding it very difficult to edit many things, i see in the viewport is different on unity compared to on the browser, I see that the one material is 100% metallic whereas in the viewport it’s 0%, also the shader is greyed out and not possible for me to change?

I’m also struggling to change the xr controls, my A button on my quest is changing the scale and I’d like to keep it just at normal scale without any teleportation.

Ive tried adding a console.log when a function is called in SpectatorCamera.ts however its not updating the script? - I did read in one of your questions about deleting the cache at .vite but still no updates.

Is this the proper way to edit scripts or?

I have used the basic sandbox template and simply removed the basic scene with my gltf however the customisation seems very limited, I’m sure it’s just a noob issue as I’m seeing everyone on here make such great things.

Thanks for your time

Original Post on Discord

by user 661970456471142400

Hey there! So we definitely aim for visual parity between Unity scene view and Needle browser view. We don’t support each and every mode in Unity (e.g. Gamma color space is not recommended), and usually we warn in the console if some of your settings aren’t compatible.

If there are differences (e.g. what you’re saying with metallic) please report them, ideally with a new question in #needle-engine-questions and a screenshot / some info about what you’re doing. We’re really aiming for parity and I’m not aware of such a big difference.
.

XR Controller adjustments are currently somewhat limited – we’re planning to change that to make it easier to configure individual buttons etc., currently it’s possible but a bit hacky. See for example this thread for how to adjust XR teleportation: Discord
.

Regarding adding code, we are shipping a good set of common components with the engine - e.g. SpectatorCamera - and you can make your own components freely with TypeScript. Custom code from your end goes into your components, and you can in most cases just copy out core components or sample components and adjust them as needed for your project.

Please note that editing code in modules and packages that come with Needle Engine is not supported like that (meaning edits in e.g. SpectatorCam.ts will not update the engine, this is similar to how it works in Unity when you install a package from the Unity registry, you can see the source code but editing the code will not work and is generally not recommended because you’ll lose the ability to update)

As Felix said you can add custom scripts or you can add patches to existing code but this should be done with caution and only if really necessary

What you can do instead is copying the source code and creating a new script file in e.g. src/scripts, give it a new name (e.g. SpectatorCamModified) and then use that one

Thank you both for replying so quick!

Re the shader this is what I mean.

And Re the custom scripts I have managed to make a script in src/scripts and noticed the codegen is doing its thing! however where am i supposed to see the converted script?

Edit after following your youtube tutorial Im expecting to see the code in Codegen folder in my assets but still no luck.

Edit 2 - Its the class name not the name of the script… sorry

Thanks again, youve been super helpful :slightly_smiling_face:

by user 661970456471142400

Hi @ordos did you have success with what you wanted to do now? :slightly_smiling_face:

Otherwise let me know - we’ll figure this out!