Skip to content

Chaining Extension Methods only works after running the script again #328

@EthanSK

Description

@EthanSK

The first time I run this

` RegisterAllExtensionMethods();

    string tempstr = @"
        local a = Vector3(0,1,2).WithX(6969).WithY(555).WithZ(666)           
        print('le vec',a)
     ";
    DynValue res = Script.DoString(tempstr);

`

It gives error ScriptRuntimeException: cannot access field WithY of userdata<UnityEngine.Vector3>

and the next time i run it in the same unity play session, I get

ScriptRuntimeException: cannot access field WithZ of userdata<UnityEngine.Vector3>

and then running it any subsequent time works.

It doesn't matter how many times I call RegisterAllExtensionMethods(), what seems to matter is how many times DoScript was called. It's like every time it runs the script, it adds to some user data a level of chaining thats supported...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions