Code gen suddenly not working

After adding a .ts to the src/scripts folder, I’ll get a console message in Unity that Run codegen for myScript.ts but no new file appears in the components.codegen file and nothing from within Add Component

Further coonsole message in Unity: Node.js not installed or could not be found..

Node is definitely installed as I can start the needle server normally

Original Post on Discord

by user 285903863339548673

Hello there – we have an experimental AI bot :robot: that might be able to help you with your question. Would you like to try this out?

How it works:
Reply to the messages of the bot that end with a thread_id to interact with it and ask follow-up questions. You can also mention the bot directly in this channel to get help.

Help requested: please wait a moment…

Here is what I found for you :brain: Discord

Can you try restarting Unity?

It appears that the TypeScript to C# component compiler is not being triggered correctly due to an issue with Node.js detection, even though Node.js is installed. This issue can prevent the code generation process from completing successfully and updating the components.codegen file.

Here’s a troubleshooting plan:

  1. Ensure Node.js is installed globally and that its path is included in the system’s PATH environment variable.
  2. Check if Node.js can be accessed from the command line/terminal by running node -v. If it cannot be found, there might be an issue with the system PATH.
  3. Confirm that the TypeScript file is correctly placed in the src/scripts/ folder and the file does not contain syntax errors.
  4. Ensure that the TypeScript file includes the export keyword, making the class visible for the compiler.
  5. Restart Unity to ensure it picks up any changes to the environment variables (after Node.js installation or PATH adjustments).
  6. If the issue persists, consider reinstalling the Needle Engine package in Unity through the Package Manager to reset any potential configuration issues.
  7. Check Unity’s console for any other related error messages that might indicate the exact cause of the problem.
  8. If available, update Node.js to the latest version, as some tools may have issues with older versions.

If you continue to experience issues after attempting these steps, consider reaching out to the Needle Engine support for further assistance. They might have additional insights or steps to resolve this specific problem with the Node.js detection and TypeScript to C# component compilation process.

1 messages left GPT 4

I’ve tried restarting - same errors

by user 285903863339548673

Which Nodejs version are you currently using and which Unity version?

2022.3.10f1 + v20.9.0

by user 285903863339548673

And the local server runs without an issue? :thinking:

Mostly! Strange issue with some objects not appearing even though the gltf debugger shows they’re in the scene

by user 285903863339548673

I can make changes to a preexisting component and it will update normally in Unity

by user 285903863339548673

Maybe worth checking regarding objects not showing:

  • the object’s layer is not disabled in the camera culling mask
  • renderer component is enabled
  • the object is also visible in the Unity GameView
  • is it using a custom shader? if yes: check if there are any shader errors in the browser console

Basically I have several variations of the same GameObject with slightly different meshes
I have made turned them into Prefabs and I’m instantiating them with the following:

    mazeElementCC?: AssetReference;

  • Doubled checked rendering components, layers, culling masks etc

All the GameObjects will appear normally when they are already in the hierarchy/scene but when they are instantiated, only 2 out of 9 will be visible even though they are all accounted for in gltfinfo

I have no idea how to debug that :frowning_with_open_mouth:
And not able to simplify the component in a new script as codegen is not working at the moment

by user 285903863339548673

What do you mean by even though they are all accounted for in gltfinfo ?

When using the gltfinfo URL parameter, I can see in the console that my assets have loaded into the scene

by user 285903863339548673

Regarding codegen: can you check the file in your Unity project in “Temp/component-compiler.log” if it contains any information regarding the node error?

Which Needle Engine version are you currently using? Would it be possible to update to the latest exp version ? I’ll try to log further debug info when “debug” is enabled in the ComponentGenerator component in the next engine version

Codegen now working again :classyblobthink:
Windows update…?

by user 285903863339548673

Did you just update windows? Or also the package?

Strange - latest version does also contain the changes mentioned above but of course it’s still alpha (lots of great changes in there tho :slightly_smiling_face: )