Is there any proper way of writing typescript as OOP like in C#

Mmh ok we will have to figure out whats wrong here tomorrow

Seems like there is a bug on the bot server. Or openai is down again

@Needle Engine Assistant
How should I write in typescript to generate such c# script in needleengine?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BoardArea
public Transform transform;
public string name;

public BoardArea(Transform transform, string name)
    this.transform = transform; = name;


public class MoveManager : MonoBehaviour
List boardAreas = new List();

by user 151660356224286721

500 The server had an error while processing your request. Sorry about that!

1 messages left GPT 3.5

500 The server had an error while processing your request. Sorry about that!

0 messages left GPT 3.5

sad, but thanks by the way !

by user 151660356224286721

Its almost that code here :wink:

What u ask here

What else do you need?

so that class BoardArea consists not just one string then a Transform too.
I wrote it like
export class BoardArea
public Areatransform!: Object3D;
public AreaName!: string;

constructor(transform: Object3D, name: string)
this.Areatransform = transform;
this.AreaName = name;

for a class in typescript and monobehaviour class for a container of custom class.
public BoardAreaList: BoardArea=;

but after build, the generated c# version of converted code, the container variable (List of custom classes) is commented out. and it’s showing on debug that this array is empty even if i push classes to the container after generating them .

by user 151660356224286721

It doesnt generate new classes that are not monobehaviours for you. You need to add this class now somewhere in your c# code.

and should I add BoardArea class as Monobehaviour and attach as a component on some gameobject? or just writing it as public class in c# Asset/something.cs is okay?

by user 151660356224286721

Just a public class

Is fine

okay I’ll try that thanks!

by user 151660356224286721


by user 151660356224286721

If… the component compiler doesnt pick it up immediately and still comments it out you can either restart unity (the reason is we generate a file for all c# types in your project but not all the time - every few minutes or if a player assemly changes)
Or you can annotate the c# type in your typescript file that you want (see component compiler docs) with a comment above the typescript field//@type YourNamespace.Classname (just an option)

Can i import BoardArea class after I wrote in BoardArea.cs somewhere in Asset Folder,
import { BoardArea} from β€œAssts/BoardArea.cs”; (somethin like this)
just like importing class BoardArea in typescript?

by user 151660356224286721

or does it works only with npm to import things exnernal ?

by user 151660356224286721

Here is what I found for you :brain: Discord