Facepunch / sbox-issues

175 stars 12 forks source link

Components in `Editor` folder can be added to GameObjects, but not the scene. #5932

Open MD485 opened 3 months ago

MD485 commented 3 months ago

Describe the bug

image image

We have some code that helps us a lot with debugging/development within our Editor project, having blacklisted code.

The problem is while I can add the component to a GameObject, that component is not serialized to the .scene file, or if added to the scene file manually is not correctly deserialized.

Ideally these components would be culled on upload instead of locally? It might unfortunately be unintuitive behaviour causing bugs in people's game modes, but I don't think preventing you from saving scenes with Editor components or preventing you from having components in Editor scripts is a great solution either.

To Reproduce

  1. Make an editor folder. image
  2. Make a script. image
  3. Apply it to a gameobject and save. image
  4. Check the scenefile. image

If added explicitly: image image

Expected behavior

The Component should serialize/deserialize correctly. At minimum give some sort of warning/error on scene saving if Editor script culling on save remains.

Additional context

I understand that this is a halfway house between a feature request and a bug report, that this was something done intentionally and with purpose, but the original functionality was useful and the editor doesn't communicate this behaviour to us at all.

I'd prefer a "You can't do this and we don't want you to do this" from the editor, or the old functionality to be restored.

In my specific case I can simply make my script fully static and avoid this issue, this still seems a useful feature though.

MD485 commented 3 months ago

It's possible this issue is related to others about library loading/linking, I found it difficult to find one I thought strongly correlated.