Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can’t clone or instantiate GSplatComponent from the template #6955

Open
ludovit-as opened this issue Sep 13, 2024 · 2 comments
Open

Can’t clone or instantiate GSplatComponent from the template #6955

ludovit-as opened this issue Sep 13, 2024 · 2 comments
Assignees
Labels
area: graphics Graphics related issue bug

Comments

@ludovit-as
Copy link

Project to reproduce: https://playcanvas.com/project/1254555/overview/splat-template-clone

When trying to instantiate a template that contains a GSplat Component like below, an exception is thrown.

// Attempt to copy entity
        const templateInstance = this.app.root.findByName("Splat template");
        const gate = templateInstance.clone();

// Attempt to instantiate template
        const template = this.app.assets.get(195964191)
        const gate = template.resource.instantiate();

If the GSplat component is substituted for a Render Component, it works. I would expect the same behavior.

Related forum post: https://forum.playcanvas.com/t/cant-clone-or-instantiate-gsplatcomponent/36948

@mvaligursky
Copy link
Contributor

I tried the repro project and it does not seem to load for me at the moment .. I get lots of pending requests.

@ludovit-as
Copy link
Author

Hmm, it's just a very basic playcanvas project without anything too special. All I do on the code is try to instantiate a template that contains a GSplat component.

If it's helpful I've published a version to launch directly: https://playcanv.as/b/50ce1d61

This is the expected (failing) console output.

Screenshot_20241114_093227

And this is the expected network requests:

image

If the project doesn't work for some reason the code that fails is just:

    try {
        const templateInstance = this.app.root.findByName("Model template");
        const model = templateInstance.clone();
        console.log(model);
    } catch (e) {
        console.warn("[model] Copy instance failed.")
        console.error(e);
    }

    try {
        const template = this.app.assets.get(195964642)
        const model = template.resource.instantiate();
        console.log(model);
    } catch (e) {
        console.warn("[model] Instanciate template failed.")
        console.error(e);
    }

    try {
        const templateInstance = this.app.root.findByName("Splat template");
        const gate = templateInstance.clone();
    } catch (e) {
        console.warn("Copy instance failed.")
        console.error(e);
    }

    try {
        const template = this.app.assets.get(195964191)
        const gate = template.resource.instantiate();
    } catch (e) {
        console.warn("Instanciate template failed.")
        console.error(e);
    }

Templates (neither the render nor the gsplat component have any asset):

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue bug
Projects
None yet
Development

No branches or pull requests

3 participants