- Edited
Hi.
(CharacterRes.tscn) contains a large number of 3D objects such as various clothing options (Clothing1, Clothing2, etc.).
A: In the global script GlobalAssetManager
, we pre-load the resource CharacterRes.tscn
into memory. This allows us to avoid re-loading it every time it's used.
extends Node
# name Script: GlobalAssetManager
var characterPreload
func _init():
characterPreload = preload("res://Assets/Resources/CharacterRes.tscn")
B: The script attached to the character receives a reference to the already loaded resource and instantiates the desired object (e.g., Clothing1
). However, the current approach adds all content from CharacterRes.tscn
, which I don't want.
extends Node
var clothingResource
var characterClothing
func _init():
clothingResource = GlobalAssetManager.characterPreload
characterClothing = clothingResource.instantiate()
add_child(characterClothing)
Question:
Is it possible to load a specific object (e.g., Clothing1) from a prefab that contains multiple objects without creating an additional copy of the entire CharacterRes.tscn
scene in memory using the already pre-loaded resource (clothingResource
)?
Are there alternative methods for efficiently managing a large volume of resources stored in one .tscn file?