Launched source code does not match the editor source code

image

As you can see here, I have written code in the PC editor to compare the lengths of two lists.
In the editor the second list uses .length, but in Chrome debugger it is .len

I have exited the editor and the launched demo and restarted both, the same code difference is visible.
Our team encountered a similar problem last night, but I don’t think they caught it on camera.

Further tests:
I closed down all browser tabs and restarted them. Opened the editor and the code was correct. Launched the game and the code was still wrong.

I made a cosmetic change to the file and saved it again. This time on launch the running code was correct.

It appears that the editor files and the ones used for the running executable can become desynced, and the system has no way of detecting this for further launches.

Hi @PeteB,

I haven’t ever experienced that before unless for some reasons I would either forget to save the code file or there is a server issue and saving fails.

As long as the file is saved it’s always consistent to see the latest results, the PlayCanvas server will not cache any asset file and always show the latest version.

If you keep having trouble, can you share repro project for the team to take a look?

That’s really weird.
If the source file wasn’t saved or the save failed, it wouldn’t have contained the correct code when I closed all browser tabs and restarted would it?

I was totally sure it had to be a caching issue with the source file not being the ground truth for the launched code. Can’t think of anything else that would cause it!

It’s highly unlikely I can share this repo, it is client work for a major brand with several different companies involved. I’ll make a point to raise the issue again if it repeats - as I mentioned previously the team reported a similar problem overnight (the code being launched was not the latest version) but they didn’t get a good screen capture like the one I shared above.

1 Like

@PeteB I have been developing apps, firebase, and cloud based applications for some years now. All of the development work I have been involved with lately has been revolved around Chrome as the browser of choice. The debugger is good and I have become familiar with the tools of the trade. Chrome is very good but there are some quarks that I would like to share.

Your issue with the code not changing in the debugger even thou you changed and saved it is a common issue. I have often beaten myself up swearing I changed the code only to look in the debugger to see that well,… it hasn’t changed.

Here are a few suggestions and things to look for.
1.) If you see that your code has not change after saving in the development environment, Enter the debugger by hitting F12 or right click and go to inspector. If you press and hold the refresh button on the upper left next to url you will see three options.
image
What I usually select is Empty Cache and Hard Reload…
Now I will say this if you do all of the above steps and you press and hold the refresh button and do not see the selections shown there are one of two issues. One you are not in debug or inspector mode. Two this is a know problem with Chrome. Sadly the suggestion is to uninstall Chrome and download latest version a reinstall.

2.) If you see the update button appear in the upper right corner of your Chrome browser that says Update weather it is Green or Red … do it…Press the button and update. I have been caught several times in mid edit of Playcanvas and other jobs when I failed to see the update appear. Things get a little weird and then I think to look and sure enough an update rolled in.

Closing the browser and reopening will sometimes produce the effect of a browser cache reset. When all else fails do the hard reset. If all of this fails fall back to refreshing your Playcanvas editor and make double sure the save occurred.

Just my experience. Hope this helps.

1 Like

Thanks for the message @Tirk182.
Unfortunately I already tried the ‘empty cache and hard reload’ (I use that by default - after years of Flash and HTML5 development, I know the risks of caching all too well!)

I tried hard reset on the editor window too. The image really does say it all: the browser version did not match the editor version after hard reset and browser close/restart. Only making an additional change to the file and saving it again worked.

Chrome hasn’t prompted me for an update for a few years, I’ve got it set to to auto-update and I close and open it several times during every day so it’s just always able to do it before that ‘final warning’ prompt appears.

1 Like

@Tirk182 Thanks for the tips.

1 Like