Fork or branch of project no longer shows the model of entity

@yaustar

I’ve got another similar situation. Let me know if you want me to open this up in another thread but here it is:

I’ve made a game that programmatically spawns platforms that have different objects on them with collision. Whenever I branch the game and press play (without changing anything) the spike object no longer shows up. The collision and its logic still function correctly, the visuals just aren’t there. If I fork the project, I get the same issue. Thoughts?

Do you get any errors in dev tools console?

Is the model asset being used by the template/clone/entity?

I do not get any errors or warnings in the console.

Here is how the sprite is implemented into the game after the entity is created:

//adds collision script
        spikeEntity.addComponent('script');
        spikeEntity.script.create("collision");
        
        //adds animated sprite
        spikeEntity.addComponent('sprite', {
            type: pc.SPRITETYPE_ANIMATED,
            autoPlayClip: 'spikeSparkle'
        });
        spikeEntity.sprite.addClip(
            new pc.SpriteAnimationClip(spikeEntity.sprite,{
                name: "spikeSparkle",
                fps: 10,
                loop: true,
                spriteAsset: this.app.assets.find("spike")
            })
        );

Seems mostly fine. Only thing I can think of is that this.app.assets.find("spike") is not getting the right asset as it doesn’t specify the asset type.

I would check what asset it is returning.

1 Like

that fixed it! I needed to specify that it was the spike sprite. thank you so much. Can you think of why it would work in one build and not in another though?

Sometimes the order of assets change in a fork or a branch as its creating a new set. So in one project, you may get the sprite, in another, it could be a folder.