godot-nim icon indicating copy to clipboard operation
godot-nim copied to clipboard

Exported variables don't update in Inspector when debugging

Open WinstonHartnett opened this issue 4 years ago • 3 comments

Exported variables in GDScript are updated in real-time in the Inspector when debugging Remote. Is this possible with GDNative/godot-nim? I've tried calling the propertyListChangedNotify method of Object, which this godot-engine issue refers to, but it seems to do nothing.

WinstonHartnett avatar Jul 17 '20 04:07 WinstonHartnett

And... nevermind. After getting real-time property updating in godot-rust and godot-mono working flawlessly, it couldn't be a GDNative problem.

It seems godot-nim doesn't update Remote Inspector properties if the debug window isn't focused? Is this a bug?

If Godot is in the foreground, Inspector values do not update even when the game loop continues just fine. This behavior is unique to godot-nim from what I've tested. I am on Arch Linux but will test on Windows tomorrow.

WinstonHartnett avatar Jul 17 '20 08:07 WinstonHartnett

Exported properties ({.gdExport.}) of godot-nim objects should behave like any other properties from Godot's perspective. If Godot updates them, they will be updated. If Godot requests a list of properties, they will be in that list. Is there an example where your issue could be reproduced?

endragor avatar Jul 18 '20 18:07 endragor

Just tested the same projects on Windows, the values do update even when the window isn't focused. This must be a Linux + GDNative bug (as Mono and GDScript work as expected on Linux). Also, I must have been mistaken, because godot-rust now shows the same odd behavior.

It can be reproduced on Linux by cloning the godot-nim-stub repo, adding a Node2D under Panel with the following Nim class:

test.nim

import godot
import godotapi / [node_2d]

gdobj Test of Node2D:
    var
        testVar* {.gdExport.}: float = 1.0

    method ready*() =
        print "Readied!"

    method process(delta: float64) =
        if self.testVar > 1000.0:
            self.testVar = 0.0
        else:
            self.testVar += 1.0

        print self.testVar

Run the debug, go to Remote and watch test_var in the Inspector update only when the game is focused.

Here's a gif demonstrating what it looks like.

WinstonHartnett avatar Jul 18 '20 20:07 WinstonHartnett