magicblock-labs / Jint-Unity

MIT License
5 stars 0 forks source link

directly call UnityEngine elements? #1

Open yosun opened 1 month ago

yosun commented 1 month ago

Is there a way to directly call Unity Engine elements, similar to Tencent PuErTS?

For example

var u = UnityEngine;
var Vector3 = UnityEngine.Vector3;
u.gameObject.transform.position = new Vector3(1,0,0);

etc

yosun commented 1 month ago

cool figured this out! also there is a meta file missing from your unity jint, so i ended up uninstalling that and just using unity nuget to get regular jint

    public void EvalThis(string eval) {
        engine = new Engine();
        engine.Execute(eval);
    }

    public void UpdateEditor(){
        EvalThis(input.text);
    }

seems kind of hacky so do let me know if there is a better way of doing this... but do u know of a way to access the UnityEngine things without having to manually write functions to expose each one