I am attempting to make a custom UI in a Verse-Coded device. I am struggling with trying to add an image texture to a texture_block DefaultImage variable.
The editor gives me the error: “Accesing instance member from this scope is not yet implemented.”
I added a “tag” to some modules, which fixed the Texture variable holding reference to the image texture in the Content Browser, however, whenever I try to implement it it just does not seem to accept it.
I have been building my UIs in some kind of fashion like this. Keeping references to potential widgets at the top initialized as false. Then, I initialize the root canvas and save references I need later in nested code blocks. There is probably a better way.
custom_ui := class:
NewTexture<protected> : texture = Widgets.Images.T_Robbery_MoneyBill_Bg
var MaybeCanvas<private>: ?canvas = false
var MaybeNewImage<private>: ?texture_block = false
InitializeCanvas<public>():void=
if (not MaybeCanvas?):
set MaybeCanvas = option:
canvas:
Slots := array:
canvas_slot:
Widget := block:
# Block of code to instantiate New Image
NewImage := texture_block:
DefaultImage := NewTexture
DefaultDesiredSize := vector2:
X:=300.0
Y:=170.0
set MaybeNewImage = option{NewImage}
NewImage # Returns this texture block from the code block