Facepunch / sbox-issues

175 stars 12 forks source link

Hammer and S&box : Edit and compile a `.vmap` used by a `SceneMap` in `GameMenu` need an S&box restart to get the modification #3706

Closed PolSpock closed 11 months ago

PolSpock commented 1 year ago

Describe the bug

Hello,

When i'm editing my map (.vmap) for a SceneMap used in my GameMenu, i'm encountering encountering several issues :

1) My compiled map is not automatically updated after a Hammer compile (Fast Compile): my GameMenu still displays the old version of the map. I need to restart S&box to get my change.

2) My builded map is not correctly built if my S&box Game Project is open: the old .vpk of the map is not correctly replaced cause is used by the engine. Even if i have closed my GameMenu. To get my .vpk correctly replaced, i need to start S&box in Content Mode and then compile my map image

Example: If my Game Project is open, the .vpk is currently used by the Game Project (cause of the SceneMap i guess) so my Hammer cannot replace the VPK : image

However, when i am on S&box Content Mode, Hammer can override the VPK after compiling: image

3) After a Hammer compiles in Content Mode. Then after returning to my S&box Game Project that loads the .vmap in his GameMenu, i have a strong chance of getting Could not load type 'Sandbox.UI.GameMenu.KeyBind' spamming error. See my video below : https://github.com/sboxgame/issues/assets/5229571/79a0ab9f-9ebb-45bc-91ff-84b1a2688a7c

To Reproduce

To reproduce : 1) Create a S&box Game Project with a GameMenu that loads a custom local .vmap in a SceneMap (new SceneMap(sceneWorld, "maps/gamemenu");) 2) Stay on your S&box Game Project view. Edit your .vmap with Hammer and compile: your VPK will not be overridden. 3) Close your S&box Game Project and switch to Content Mode, edit your .vmap, and compile: your VPK will correctly be overridden. 4) Finally, return to your S&box Game Project, your GameMenu will be automatically open but your .vmap loaded by your SceneMap will not be updated: the new change didn't appear and you have to restart your game.

Expected behavior

Editing a .vmap used by a SceneMap from GameMenu must have to be updated without a S&box restart. Also, the Could not load type 'Sandbox.UI.GameMenu.KeyBind' spamming error after a switching project must not occur.

Media/Files

No response

Additional context

No response

handsomematt commented 11 months ago

@kurozael sorted this a while ago i think