I have the following shared class defined in a separate file: (as described by the documentation here: https://www.angelcode.com/angelscript/sdk/docs/manual/doc_script_shared.html)
shared class Foo
{
void MethodInFoo(int b) { bar = b; }
int bar;
}
Then I have 2 modules that include this file:
#include "SharedStuff.as"
void Main()
{
Foo@ f = Foo();
}
#include "SharedStuff.as"
void Main()
{
}
When both modules are loaded, everything works as expected - the class is shared and can be passed between modules as expected.
However, when the first module gets discarded and a new module gets created (with the same script), the class seems to suddenly become invalid, giving the following error on the Foo instantiation line:
INFO : Compiling void Main()
ERR : Can't implicitly convert from 'void' to 'Foo@&'.
If I discard the 2nd module and then do the same thing (discard 1st and reload it) then it works as expected again.
Is there some kind of refcounting going wrong on the shared class when 2 modules are using it?