Any idea why can't I use enum as a variable?

@Needle Engine Assistant
3. Project Configuration: Check the project’s configuration and settings for the Needle Engine. Ensure that the components and scripts are configured properly within the Needle Engine’s environment or Unity project.

  1. Correct Engine Version: Make sure that you are using the correct version of the Needle Engine for generating the C# code. If there are multiple versions, verify that you are working with the compatible version.

5.Other Dependencies: If the TypeScript file relies on other custom classes, ensure that these are also correctly configured and compatible with the Needle Engine’s C# generation process.

explain more of these in steps please.

by user 151660356224286721

Here is what I found for you :brain: Discord

Certainly! Let’s go through the steps in detail for each item you’ve mentioned.

3. Project Configuration

Check that the project’s configuration is set up correctly with these steps:

  • Script Placement: Ensure TypeScript files are placed in the correct folder. For example, Needle Engine might expect script files to be in a Scripts folder.
  • TypeScript Compiler: Confirm TypeScript compilation is enabled in the Needle Engine settings within your project.
  • Component Registration: Verify that all custom components are registered with the engine. The Needle Engine might require a specific setup or registration in Unity for components to be recognized.

4. Correct Engine Version

Verify the version compatibility of the Needle Engine:

  • Version Check: Look at the Unity Package Manager and check the installed version of the Needle Engine package. Ensure it’s up to date or the specific version required by your project.
  • Compatibility: Ensure that your TypeScript code uses language features supported by the Needle Engine version you are working with.
  • Documentation: Review the version-specific documentation to understand any nuances between different releases.

5. Other Dependencies

The handling of custom classes and their compatibility:

  • Reference Checks: Make sure any custom classes referenced in your scripts (like MovementManager) are also valid TypeScript classes that can be compiled by the Needle Engine.
  • Custom Class Configuration: For each custom class, check that they extend from the correct class (e.g., Behaviour) and use the @serializable decorator as needed.
  • Dependency Order: The compiler must be aware of dependencies in the right order. If a class A depends on class B, class B must be compiled beforehand.

thread_567y7ByPEJSt39JwcFVJgfKw

By following these steps, you can help ensure that the project configuration, engine version, and other dependencies are set up correctly to facilitate successful C# code generation with the Needle Engine.

4 messages left GPT 4
thread_567y7ByPEJSt39JwcFVJgfKw

Hi @Ken2 where did you put your script files? Do you have a component compiler component in your scene?

@Marcel_Wiessler1 :cactus: hi thanks for the reply ,
yes I have Component Generator on my ExportInfo

by user 151660356224286721

by user 151660356224286721

Do you see any logs in unity when you save your script (change something then save) and then focus unity?

yes I see them

by user 151660356224286721

What logs do you get? There’s also a link to the compiler log file included in one of the logs, it may contain a reason for why no script is generated

yeah it is shown that one of the type is not defined.

Unknown array type for “@boardAreaList BoardArea” - your type is probably not known (did you just create it this session?) and you might need to regenerate the Typemap in Unity. Go to "Needle Engine/Internal/Generate Type Map for component compiler
EMIT member: “@boardAreaList Last type found: null

by user 151660356224286721

Can you try that menu item? It’s basically the same a restart of Unity.

And do you have a “BoardArea” type in your project?

If the compiler doesnt find it automatically you can annotate the type to FORCE it to generate the correct one

see Editor Component Generator | Needle Engine Documentation with the “@type” syntax

so I restarted my Unity and the error still seems to occur,
I do have a BoardArea type in my Project
I have no idea why // public Piece @pieceInCurrentArea; → Could not resolve C# type on BoardArea
It did not happen before but suddenly those commented out spreaded like a plague.
image.png
image.png

by user 151660356224286721

Here is a workaround for you if for some reason the type can not be automatically found in your project

@Marcel_Wiessler1 :cactus:
My first assumption, the reason for blocking my custom classes is from enum generation,
which I tried to match it with C# generated script, in this case should I use @dont-generate-component?
could you tell me where to write @dont-generate-component?


image.png
image.png

by user 151660356224286721

here includes three screenshots

by user 151660356224286721

but the odd thing is If I generated a C# component called Pawn which derives from Piece also has the same structured enum Variable @serialized but this generates correctly c# scripts
image.png

by user 151660356224286721