Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

godot preload

const pre_enemy_factory = preload("res://src/enemyfac.tscn")
var enemy_factory
func _ready():
  enemy_factory = pre_enemy_factory.instance()

func add_enemy:
  var enemy = enemy_factory.get_child("your enemy").duplicate()
  level.add_child(enemy)
Source by godotengine.org #
 
PREVIOUS NEXT
Tagged: #godot #preload
ADD COMMENT
Topic
Name
5+6 =