// NEEDLE_CODEGEN_START
// auto generated code - do not edit directly
using UnityEngine;
using UnityEngine.Animations;
#pragma warning disable
namespace Needle.Typescript.GeneratedComponents
{
public partial class LookAt : UnityEngine.MonoBehaviour
{
public LookAtConstraint @target ;
public void update(){}
}
}
// NEEDLE_CODEGEN_END
by user 855361388318425109
this is what i was trying to do
by user 855361388318425109
marcel
(marwi)
October 18, 2022, 12:00am
23
for example:
import { Behaviour, serializeable } from "@needle-tools/engine";
import { Object3D } from "three"
export class LookAt extends Behaviour {
@serializeable(Object3D)
otherObject?: Object3D;
update() {
if (this.otherObject)
this.gameObject.lookAt(this.otherObject.position)
}
}
ok what should i name the file ?
by user 855361388318425109
marcel
(marwi)
October 18, 2022, 12:00am
25
marcel
(marwi)
October 18, 2022, 12:00am
27
You can even have multiple scripts in one typescript file
cs ?
by user 855361388318425109
c#
by user 855361388318425109
marcel
(marwi)
October 18, 2022, 12:00am
30
You put it in a file like LookAt.ts
marcel
(marwi)
October 18, 2022, 12:00am
31
in src/scripts
for example
marcel
(marwi)
October 18, 2022, 12:00am
32
marcel
(marwi)
October 18, 2022, 12:00am
33
And you can download a project from Samples Projects | Needle Engine Documentation if you need more examples
na that’s not working
by user 855361388318425109
by user 855361388318425109
by user 855361388318425109
the file is not showing
by user 855361388318425109
yet it’s inside
by user 855361388318425109
marcel
(marwi)
October 18, 2022, 12:00am
40
you mean the c# code? Its generated in Assets/Needle/Components.codegen
if you put it in thesrc/scripts
folder