Normally the clearscope keyword isn't allowed with member variables, but an oversight allows inner structs to be declared as such. When creating a field of that type, the field will also have data scope. This means that the UI and playsim can both fully read and write to it as they please. Example:
Code: Select all
version "4.8"
class Test : EventHandler
{
struct T clearscope
{
int v;
}
T tester;
override void UITick()
{
console.printf("%d", tester.v);
tester.v = 3;
}
override void WorldTick()
{
console.printf("%d", tester.v);
tester.v = 6;
}
}
When tested in game, you'll notice that there are no read or write access errors and that the value will update based on whether the playsim or UI updated it last.