-
I was just following the docs I saw in the code comment for Signal.Solo:
My code below. type World struct {
classdb.Extension[World, Node2D.Instance] `gd:"NXRWorld"`
Model *model.Model
RequestLevel Signal.Solo[int] `gd:"request_level"`
NavigationMesh NavigationMesh.Instance
} Not implemented error:
Are signals not supported yet? To avoid the XY problem, I'm trying to call a function in a sibling node to my Go node, then receive the function's return value in another signal (trying to keep my Go bits as decoupled as possible) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If you just need to Emit values from Go to the engine/GDScript, you can use Go send-only channels for signals that send a single value, this has an example that works https://github.com/grow-graphics/eg/blob/master/1d/signals/signals.go package main
import (
"time"
"graphics.gd/classdb"
"graphics.gd/startup"
"graphics.gd/variant/Object"
"graphics.gd/variant/Signal"
)
type Signals struct {
classdb.Extension[Signals, Object.Instance]
Something chan<- struct{} `gd:"something"`
Generic Signal.Solo[int] `gd:"generic"`
}
func (s *Signals) DoSomething() {
go func() {
time.Sleep(time.Second)
s.Something <- struct{}{}
s.Generic.Emit(22)
}()
}
func main() {
classdb.Register[Signals]()
startup.Scene()
} The Signal package types are primarily for working with the lower level signal functions, or to support Go consumers. They still need to be hooked up with class registration so that they work as designed. I'll take a look at this over the weekend. |
Beta Was this translation helpful? Give feedback.
If you just need to Emit values from Go to the engine/GDScript, you can use Go send-only channels for signals that send a single value, this has an example that works
https://github.com/grow-graphics/eg/blob/master/1d/signals/signals.go