Jump to content

Trying to pre-load assets but when the scene changes the _uvs are null


Recommended Posts

I'm loading the assets before creating the Game and I store the loader in a context so that every class can use that scene loader. Th first time such a scene loads everything works fine, but when the next scene with those sprites come ack I get this error "Cannot read property 'uvsFloat32' of null". I want to preload those assets, because I don't want to reload these assets for every scene, because they are used very frequently, like the Player and UI those are in every game scene and I thought that the loading times would improve if I would load those once at the begin.

Link to post
Share on other sites

Even if I do: this._container.destroy({ children: falsetexture: falsebaseTexture: false});

Still the _uvs are gone after a reload of the scene.

This is how I go to another Scene: 

async goTo(nameScenes) {
    this.previousSceneIndex = this.currentSceneIndex;
    const goTo = name;
    if (goTo > this.scenes.length - 1 || goTo < 0 || this._loadingScenereturn;
    this._loadingScene = true;
 
    const nextScene = await this.scenes[goTo](this);
    this.currentScene.destroy();
    this.currentScene = nextScene;
 
    this.currentSceneIndex = goTo;
    this.stage.addChild(this.currentScene.container);
    this._loadingScene = false;
  }
Link to post
Share on other sites

Th errors come from the AnimatedSprite component and the Sprite. The text doesn't give any errors. I don't know which sprites don't work, because I can't debug that, but there are a lot of errors so I think all of the preloaded sprites

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...