Godot Version
4.41
Question
Variables I create in _ready are not available to the _on_process func() ??
4.41
Variables I create in _ready are not available to the _on_process func() ??
idk about gd_script but the scope of that variable is within the function it is created on, if i am correct.
declare it before _ready
Okay I have declared the variable, but it is still NULL in _process
extends Node3D
var cube
func _ready():
var root = sg.GetRootNode()
# --- Create a camera ---
var camera = sg.CreateCamera(root)
sg.SetPosition(camera, 0,0,5)
sg.PointCamera(camera,0,0,0)
# --- Create a cube ---
var cube = sg.CreateCube(root)
func _process(delta):
sg.Move(cube, 1,0,0, delta )
Okay figured it out.
Was re-declaring it locally by using var in the _ready function. Removed that and all is good.