Can`t preload resource at path: res://Scence/AsteroidSmall.tscn

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By NiFiON

extends “res://Codes/Weightless.gd”

var AsteroidSmall = preload(“res://Scence/AsteroidSmall.tscn”)
var AsteroidMedium = preload(“res://Scence/AsteroidMedium.tscn”)

export (float) var explode_force = 300

signal explode

enum Size {
SMALL, MEDIUM, LARGE
}

export (Size) var size = Size.LARGE
var radius

func _ready():
connect(“explode”, self, “_explode”)
radius = get_node(“Sprite”).texture.get_width() / 2 * get_node(“Sprite”).scale

func _explode():
if size != Size.SMALL:
for i in range(0,3):
var offset_dir = PI * 2 / 3 * i
var asteroid
match size:
Size.MEDIUM:
asteroid = AsteroidSmall.instance()
Size.LARGE:
asteroid = AsteroidMedium.instance()
asteroid.position = position + radius.rotated(offset_dir)
asteroid.linear_velocity = linear_velocity + Vector2(explode_force, 0).rotated(offset_dir)
get_parent().add_child(asteroid)
queue_free()
sleeping = true
pass

where is the mistake?

Do you have a .tscn file at the path Scence/AsteroidSmall.tscn? This path is case-sensitive (or it will become so in an exported project, on Windows). Make sure you didn’t make a typo in the path (if your folder is called Scene or Scenes instead, it must match).

The same thing applies to Scence/AsteroidMedium.tscn.

Calinou | 2022-03-24 16:34