Types in Needle Engine

Where I can find all renamed types from Unity to Needle? In image below, some changes written. I currently need Material, Color, float equivalents. And how to initialize them in declaration

Original Post on Discord

by user 267660755443122181

Hey :wave:


    // from three
    color?: Color;

    // from three
    mat?: Material;

    @serializable() //you don't need to specify the serialized type with primite types
    num?: number;


Sometimes it doesn’t offer three types as good :confused: This is where to import the types from

import { Material, Color } from "three";

While also mind that if you want to interact with the material and not only set it to some other renderer. You should be aware that you need to retype it in order to interact with it “safely”.

By that i mean, if it is using the UnityGltf/PBRGraph shader, then you can safely retype the mat variable to MeshStandardMaterial, then by accesing that it should whisper all the properties that you can set.

const standardMat = mat as MeshStandardMaterial;
if(standardMat) {
    standardMat.color = new Color(1, 0, 1);

Alternativly, you can property access anything on the object, so you can blindy set it or get it as well (That’s when you don’t need to cast it to another type but you have no guarantee that the changes will apply) - the material could be potentially any shader with any properties. (myColor istead of color)

if(this.mat) {
  this.mat["color"] = new Color(1, 0, 1);