Chaining Extension Methods only works after running the script again
EthanSK opened this issue · comments
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...