Project link: PlayCanvas 3D HTML5 Game Engine
As shown in the project, when I try to clone or instantiate a template with a GSplat it fails with the following exception:
Note: It works fine with the Render Component.
TypeError: Cannot read properties of null (reading 'clone')
at GSplatComponentSystem.cloneComponent (https://code.playcanvas.com/playcanvas-1.73.5.dbg.js:111921:52)
at Entity._cloneRecursively (https://code.playcanvas.com/playcanvas-1.73.5.dbg.js:71020:25)
at Entity._cloneRecursively (https://code.playcanvas.com/playcanvas-1.73.5.dbg.js:71025:34)
at Entity.clone (https://code.playcanvas.com/playcanvas-1.73.5.dbg.js:71002:23)
at TemplateClone.postInitialize (https://launch.playcanvas.com/api/assets/files/templateClone.js?id=195964192&branchId=9df7dcae-4b37-41ed-a0aa-0f94255158c6:29:39)
The function
cloneComponent(entity, clone) {
const gSplatComponent = entity.gsplat;
// copy properties
const data = {};
for (let i = 0; i < _properties.length; i++) {
data[_properties[i]] = gSplatComponent[_properties[i]];
}
data.enabled = gSplatComponent.enabled;
// gsplat instance cannot be used this way, remove it and manually clone it later
delete data.instance;
// clone component
const component = this.addComponent(clone, data);
// clone gsplat instance
component.instance = gSplatComponent.instance.clone();
if (gSplatComponent.customAabb) {
component.customAabb = gSplatComponent.customAabb.clone();
}
return component;
}
at line component.instance = gSplatComponent.instance.clone();
the property gSplatComponent.instance
is null.
This looks like a bug. Is this behavior expected?
Thanks.