Scripting Define Utility is a small helper that allows you to more easily modify the scripting define symbols for your project.
- The package is available on the openupm registry. You can install it via openupm-cli.
openupm add net.tnrd.scriptingdefineutility
- Installing through a Unity Package created by the Package Installer Creator from Needle
There's a couple of interactions you can do with the ScriptingDefineUtility
Adding a new define symbol to the list
private void Foo()
{
ScriptingDefineUtility.Add("Bar");
}
Removing an existing define symbol from the list
private void Foo()
{
ScriptingDefineUtility.Remove("Bar");
}
Checking if a symbol is in the current symbols list
private void Foo()
{
if (ScriptingDefineUtility.Contains("Bar"))
{
...
}
}
There are two ways of getting all the define symbols
This returns all the symbols as stored in the settings.
private void Foo()
{
string symbols = ScriptingDefineUtility.GetSymbols();
}
This returns all the symbols split by the delimiter ; (semicolon) and returns it as a string array
private void Foo()
{
string[] symbols = ScriptingDefineUtility.Symbols;
}
Scripting Define Utility is a small and open-source utility that I hope helps other people. It is by no means necessary but if you feel generous you can support me by donating.
Pull requests are welcomed. Please feel free to fix any issues you find, or add new features.