*Filed bug report here: https://github.com/godotengine/godot/issues/42815
*I tried this modification (in both places), attempting to override the cache, but I still get the same duplicate results! ResourceLoader.load(path, type_hint, no_cache)
var floor_resource = ResourceLoader.load("FloorBlock.tscn","",true)
*this is related to caching, and I'm researching "take_over_path" but I don't know how to implement it.
I have some code on a script on a root tree, simple, I threw it on a "Node" because it doesn't interact with its parent. When the game starts it preloads two blocks,
var floor_resource = preload("FloorBlock.tscn")
var floor_tile = floor_resource.instance()
floor_tile.transform.origin = Vector3(0,1,0)
add_child(floor_tile) # self is implicit
var floor_resource2 = preload("FloorBlock.tscn")
var floor_tile2 = floor_resource2.instance()
floor_tile2.transform.origin = Vector3(0,5,0)
add_child(floor_tile2) # self is implicit
And then the blocks have this code;
var x = rand_range(1,20)
var z = rand_range(1,20)
var halfVect = Vector3(x/2, 1, z/2)
$CollisionShape.shape.extents = halfVect
var newVect = Vector3(x, 1, z)
$MeshInstance.mesh.size = newVect
Every single time I get two blocks of the same size. Why? I instantiated them into different variables, from two different calls, and made sure to use randomize() when getting my numbers, so why do they come out the same size?
I can easily see in my output that the random numbers and vector3's are different.
FloorBlock.tscn is nothing but a RigidBody with a MeshInstance (CubeMesh) and CollisionShape (boxShape). The root scene is blank except for the node, script and camera.