The problem with your attempt is that the Test2
object doesn’t access the good Test
object.
@editable TestClass : Test = Test{} # Here you're creating a new Test object using its constructor, so the functions are usable but
# they won't return any data you've set in your code above
Ok so basically I think of 3 ways to do this :
- You give a reference to your TestClass (device) when initializing your Test2 class, like this :
Test2 := class():
MyDevice:Test
Test := class<unique>(creative_device):
var TestClass2 : ?Test2 = false
OnBegin<override>()<suspends> : void =
set TestClass2 = option{Test2{MyDevice := Self}}
Now your Test2 class has a link to your Test device and your functions are working, you just need to unwrap your TestClass2 everytime (surely there’s a bit cleaner way to do it)
-
You try to implement singletons as described in I came up with a way to make singletons in Verse
This solution is cleaner if you’re gonna have lots of classes each connected to eachother. -
You make your Test2 a device too, and with @editable attribute you assign both the Test and Test2 to eachother inside UEFN.