Cannot read properties of undefined (reading 'branch')

Hello, have you ever had error
Cannot read properties of undefined (reading ‘branch’)
on launch.js (system file)

i looked into that file and saw error happens on config.self.branch

i have this error when trying to switch scenes dynamically, also after saving changes in scene scripts

thx

Hi @Dima_Romanchuk and welcome,

You mean in editor, in the console your are getting this error?

@yaustar any idea?

Can you post a link to the project. It’s possible you are trying access a scene that doesn’t exist or from another project that you don’t have access to

yes, i looked into launch.js file


error happens in
config.self.branch
in last return statement

it’s a private project, i only have properties of writing and reading
project has 1 branch (master)

Can you give me temp access to the project (read is fine) as ‘yaustar’ and also the repro steps on creating the error. I can take a quick look

You have access
project name is “ShowRoom” https://playcanvas.com/project/867478/overview/showroom

to reproduce error you should:

  1. press Launch
  2. on scene press X button (it has to switch scenes), error will happen on this step

scene switching manages in ChangingScenes.js

thank you

Which scene do I load first?

WalletDev

error happens when switching from this scene
it has to switch to Character scene
vice versa error not happens

I don’t see a X in the WalletDev scene

it’s keyboard button, sorry

1 Like

It’s very possible the issue is due to the usage of the wallet and the error here:

That might have stopped the scenes from properly being registered on startup. I’ve seen a similar error on Discord with someone else using a wallet

1 Like

oh, thank you :innocent:
we will work in that way

Hmm, that doesn’t seem to be it. Still investigating

i see, i turned off wallet script
ethereum error gone, but not topic one

I think I see the problem.

There’s a global variable normally in the launch tab of a project. (window.config) that is used by launch.js

I think there might be a library or code in your project that is overriding that global and therefore some parts don’t work like scene loading

Edit: in game.js line 406, there is a bit where the global config variable is set to a different object.

To fix this, you will need to use a differently named variable as a global, adding it into a namespace or have it scoped to the Game.js script object

1 Like

oh, that was really mad error
and now it is solved
thank you, you saved our day :cowboy_hat_face:

1 Like