Export var Problems

Godot Version

4.2.2 Stable

Question

When i run the scene the Exported var disapears and resets to the initial value, until i edit the code. What did i do wrong?

here is the code:

extends Node3D

@export_range(10,360) var spinSpeed :int

var rotSpeed := Vector3(0,spinSpeed,0)
var coin : Node3D

func get_Node() -> Node3D:
	for child in get_children() :
		print(child)
		if child is Node3D:
			return child
	return null

func _ready():
        print(spinSpeed)
	coin = get_Node()
	coin.set_rotation_degrees(Vector3(90,0,0))
	
	


func _process(delta):

	var ro : Vector3 = coin.get_rotation_degrees() + rotSpeed * delta 
	ro.y = wrapf( ro.y , 0.0 , 360.0)
	coin.set_rotation_degrees(ro)

output:

0 #the spinSpeed
Coin_Wood_1:<Node3D#27497858247>

and an Image:
befor f6
grafik
after f6
grafik

That 10 value is just a fake 10, which is the min value of the exported range, it’s not actually 10 but 0, try to set it to 10 manually.

Of course, you don’t want to configure this every time, so consider assigning a default value, such as

@export_range(10, 360) var spinSpeed: int = 10
2 Likes

sadly that didn’t solve the issue of it ignoring the number i give it.

the dicaperance Problem somehow solved it self :disappointed_relieved: (of the Spin Speed var)