I’ve tried adding the Rotate.ts script as per the documentation but I am not getting any Monobehavior script in Needle/Components.codegen
I get two Unity console messages after saving my Rotate.ts script:
/Assets/../Library/Needle/CodeGen/Types.json
SourceFiles: -1
Run codegen for Rotate.ts at ...../Needle/CollaborativeSandbox/src/scripts/Rotate.ts```
I've tried enabling/disabling the Code Generator Component in Unity
[Original Post on Discord](https://discord.com/channels/717429793926283276/1052641521092009984)
*by user 285903863339548673*
marcel
(marwi)
December 15, 2022, 12:00am
2
Are you on windows? What is your project path? The run codegen
path in the log looks suspicious (starting with ...../Needle
)
Hi. I’m on Mac. I’ve just edited out the rest of the file path that has my name and other bits in it
by user 285903863339548673
marcel
(marwi)
December 15, 2022, 12:00am
4
Ah I see. Does the path look correct? Maybe replace it with xxxx next time makes it less confusing^^
But SourceFiles: -1 also looks wrong
marcel
(marwi)
December 15, 2022, 12:00am
5
Does the log say anything? The console log should also contain a path where the compiler produces a log file - maybe it has some info on why it didnt output a script
Haha I see the confusion now. Yes the path is correct
by user 285903863339548673
marcel
(marwi)
December 15, 2022, 12:00am
7
I’ve also asked for the path because we sometimes had issues with special characters in paths (e.g. paths containing (
)
Ok, let me just copy and paste the full log
by user 285903863339548673
marcel
(marwi)
December 15, 2022, 12:00am
9
Could you also try creating a npmdef and copy paste your script there?
SourceFiles: -1
Time since last update: 121.095099
UnityEngine.Debug:Log (object)
Needle.Engine.Codegen.TypesGenerator:GenerateTypesIfNecessary () (at Library/PackageCache/com.needle.engine-exporter@2.53.3-pre.1/Core/Runtime/Codegen/TypesGenerator.cs:60)
Needle.Engine.Codegen.ComponentGeneratorRunner/<Run>d__0:MoveNext () (at Library/PackageCache/com.needle.engine-exporter@2.53.3-pre.1/Core/Runtime/Codegen/ComponentGeneratorRunner.cs:35)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<bool>:Start<Needle.Engine.Codegen.ComponentGeneratorRunner/<Run>d__0> (Needle.Engine.Codegen.ComponentGeneratorRunner/<Run>d__0&)
Needle.Engine.Codegen.ComponentGeneratorRunner:Run (string,string,string,string)
Needle.Engine.Codegen.CodeWatcher/<ProcessChangedFiles>d__29:MoveNext () (at Library/PackageCache/com.needle.engine-exporter@2.53.3-pre.1/Core/Runtime/Codegen/CodeWatcher.cs:160)
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start<Needle.Engine.Codegen.CodeWatcher/<ProcessChangedFiles>d__29> (Needle.Engine.Codegen.CodeWatcher/<ProcessChangedFiles>d__29&)
Needle.Engine.Codegen.CodeWatcher:ProcessChangedFiles ()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions () (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorApplication.cs:356)
by user 285903863339548673
Command: node component-compiler.js "/Users/durril/Documents/Unity Projects/Needle Engine Test/Assets/Needle/Components.codegen" "/Users/durril/Documents/Unity Projects/Needle Engine Test/Needle/CollaborativeSandbox/src/scripts/Rotate.ts" in /Users/durril/Documents/Unity Projects/Needle Engine Test/Library/PackageCache/com.needle.engine@2.53.1-pre.1/package~/node_modules/@needle-tools/needle-component-compiler/src
Log at: /Users/durril/Documents/Unity Projects/Needle Engine Test/Assets/../Temp/component-compiler.log
UnityEngine.Debug:Log (object)
Needle.Engine.Codegen.ComponentGeneratorRunner/<Run>d__0:MoveNext () (at Library/PackageCache/com.needle.engine-exporter@2.53.3-pre.1/Core/Runtime/Codegen/ComponentGeneratorRunner.cs:39)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<bool>:Start<Needle.Engine.Codegen.ComponentGeneratorRunner/<Run>d__0> (Needle.Engine.Codegen.ComponentGeneratorRunner/<Run>d__0&)
Needle.Engine.Codegen.ComponentGeneratorRunner:Run (string,string,string,string)
Needle.Engine.Codegen.CodeWatcher/<ProcessChangedFiles>d__29:MoveNext () (at Library/PackageCache/com.needle.engine-exporter@2.53.3-pre.1/Core/Runtime/Codegen/CodeWatcher.cs:160)
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start<Needle.Engine.Codegen.CodeWatcher/<ProcessChangedFiles>d__29> (Needle.Engine.Codegen.CodeWatcher/<ProcessChangedFiles>d__29&)
Needle.Engine.Codegen.CodeWatcher:ProcessChangedFiles ()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions () (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorApplication.cs:356)
by user 285903863339548673
Will do
by user 285903863339548673
marcel
(marwi)
December 15, 2022, 12:00am
13
That’s the path I meant /Users/xxxxx/Documents/Unity Projects/Needle Engine Test/Assets/../Temp/component-compiler.log
by user 285903863339548673
No file named component-compiler.log
by user 285903863339548673
marcel
(marwi)
December 15, 2022, 12:00am
16
Can you try opening a terminal and run this command:
node component-compiler.js "/Users/durril/Documents/Unity Projects/Needle Engine Test/Assets/Needle/Components.codegen" "/Users/durril/Documents/Unity Projects/Needle Engine Test/Needle/CollaborativeSandbox/src/scripts/Rotate.ts"
in this directory:
/Users/durril/Documents/Unity Projects/Needle Engine Test/Library/PackageCache/com.needle.engine@2.53.1-pre.1/package~/node_modules/@needle-tools/needle-component-compiler/src
Ok I got this back ``` SourceFile
ImportDeclaration
ImportClause
NamedImports
ImportSpecifier
Identifier
ImportSpecifier
Identifier
StringLiteral
ClassDeclaration
Found class: Rotate
NAMESPACE Needle.Typescript.GeneratedComponents
Rotate inherits UnityEngine.MonoBehaviour
ExportKeyword
Identifier
HeritageClause
ExpressionWithTypeArguments
Identifier
PropertyDeclaration
Found variable @serializable ()
speed : number = 1;
Variable: speed
Child: NumberKeyword → float
EMIT member: “float” @speed = 1f Last type found: null
Decorator
CallExpression
Identifier
Identifier
NumberKeyword
FirstLiteralToken
MethodDeclaration
Identifier
Block
ExpressionStatement
CallExpression
PropertyAccessExpression
Identifier
Identifier
ThisKeyword
MethodDeclaration
Identifier
Block
ExpressionStatement
CallExpression
PropertyAccessExpression
PropertyAccessExpression
ThisKeyword
Identifier
Identifier
BinaryExpression
PropertyAccessExpression
PropertyAccessExpression
PropertyAccessExpression
ThisKeyword
Identifier
Identifier
Identifier
AsteriskToken
PropertyAccessExpression
ThisKeyword
Identifier
Write to /Users/durril/Documents/Unity Projects/Needle Engine Test/Assets/Needle/Components.codegen/Rotate.cs
EndOfFileToken
*by user 285903863339548673*
marcel
(marwi)
December 15, 2022, 12:00am
18
Did it also write the file?
It did!
by user 285903863339548673
marcel
(marwi)
December 15, 2022, 12:00am
20
Ok great - so something is not working with sending the command to the compiler maybe