New "Scripting Define Symbols" UI

Hello heroes from the QoL team :slight_smile:

Thank you for the recent Quality of Life blog-post.

Here is a screenshot from my hobby project. Projects at work have about 15 scripting defines.

Unfortunately, from an usage point of view, this being a list now is actually a step back for me. :frowning: The main reason why I find it less useful, is because I no longer can copy and paste all scripting symbols.

I would find it much more user friendly if this can be changed to a single multi-line word-wrapped text-field instead. A new line, space, comma, semicolon, etc are used as separators. This would allow me to much more efficiently add/remove/copy/paste scripting symbols.

3 Likes

It's for sure an improvement for us over the old version, as it's a lot easier to read - when do you copy-paste the define symbols?

If it was a text-field that tried to be smart about dealing with whitespace, it should show the final result as a string somewhere in the UI, so you don't run into gotchas.

1 Like

How about instead it detects semicolons in whatever you’re pasting? So you could paste “A;B;C” into one of the entries and it’ll turn that into several automatically. That way, we keep the list UI while still being able to paste in defines.

2 Likes

Yes, same here
we need both, list + paste string of all the defines

+1 +1 +1

+1. Also if the that list supports multi-selections, and copying those selected entries would fill the clipboard with the standard semicolon-seperated string, this would keep things consistent.

But why 15 define flags, though, and why do you have to copy them around? Are those for some mega-libraries?

1 Like

We use scripting defines to toggle (development) features in the game.

For example in debug and development builds we support cheats by adding the COMPANYNAME_CHEATS to the scripting symbols.

Unity stores scripting defines per platform. If I add or remove a scripting define I often want to do this for all platforms. Or to transfer scripting defines from one project to another.

One of the solutions to your issue @Peter77 would be to use editor scripts to automate define symbols for the platforms. At work there is an editor menu for enabling/disable some symbols that get applied automatically. This would be my counterargument to you.

As for why you need to copy and paste from project to project, that’s another thing…

1 Like

Yes, centralized codebase used in different projects with some features off and on with help of defines

QoL code wise for this would be nice too, instead of dealing with a single flat string that other libraries would mess with, I’d rather prefer a single method overload to the questionably long method name.

ProjectSettings.SetScriptingDefineSymbolForGroup(BuildTargetGroup.Standalone, "DEBUG", true);
2 Likes

There’s a free asset with saving/loading presets https://assetstore.unity.com/packages/tools/utilities/ez-define-symbols-preprocessor-directives-manager-75541

Will take 5+ years until Unity makes better one so…

2 Likes

I mean... the one we currently have is good enough, Im not a sure if a designer would be responsible for even looking at or managing the define symbols. The UI seems like the wrong tree bark, we could've had the old one even, just a better API would be tremendous.

I hope it could be a toggle list or a preset. That makes more easy to switch between different settings.

1 Like

Hello!

Thanks for the report. We are already working on improvements for this, so it should land in the near future. Also, multiple defines can be pasted to one field and they will be separated after applying changes.

3 Likes

@justinas_p In our setup we use define symbols to switch between demo and full game releases. The problem is that when anyone in the team adds the demo symbol, it changes their ProjectSettings.asset and it often accidentally ends up in the VCS. It would be great if Unity provided some support for such setups, for example:

  • Add some way to define “local define symbols”, outside of the ProjectSettings.asset, in a file which isn’t stored in VCS.

  • Add some form of official support for “project configurations”.

Copy defines + Paste never worked for me and I just tested it on 2021.3f1.

This works like a charm <3

Just want to add that this new UI is still bugged up the wazoo in the the last 3 version.

Removed, renamed or newly added preprocessor defines are simply not working in the assembly.

It is so unreliable at the moment I am the point of simply rewriting the entire code base of our game because that would at least give a reliable build.