Guidance with Asset spawning/AssetPool
Hi there, creators. For the past few days, I've been struggling to find an optimal way to spawn weapons and baskets for each player. Previously, before discovering the AssetPool Gizmo, i spawned each weapon and basket for each player. This worked, and to no surprise, it was really slow ( and now in the latest version of the desktop editor, it either locks up the UI trying to spawn or isn't visible in the editor). Utilizing the AssetPool Gizmo didn't lock up the UI; however, despite having a simple asset reference continues to return `undefined` instead of the spawned entity when i attempt to retrieve it from the pool. Could i be missing something? or is this Gizmo/ Asset Spawning buggy at the moment?
Code snippet
private spawnBasket(player: Player): void {
// Try pool first
if (this.basketPoolGizmo) {
const basket = this.basketPoolGizmo.getPooledEntity();
console.log(basket) // always seems to print undefined
if (basket) {
const attachable = basket.as(AttachableEntity);
if (attachable) {
attachable.attachToPlayer(player, AttachablePlayerAnchor.Torso);
attachable.socketAttachmentPosition.set(new Vec3(0, 0, -0.5));
}
this.playerPooledBaskets.set(player.id, basket);
console.log(`GameManager: Basket attached (pooled) for ${player.name.get()}`);
return;
}
}
