Skip to content

Thundernerd/Unity3D-ScriptingDefineUtility

Repository files navigation

Scripting Define Utility

GitHub package.json version GitHub issues GitHub pull requests GitHub license GitHub last commit

Scripting Define Utility is a small helper that allows you to more easily modify the scripting define symbols for your project.

Installation

  1. The package is available on the openupm registry. You can install it via openupm-cli.
openupm add net.tnrd.scriptingdefineutility
  1. Installing through a Unity Package created by the Package Installer Creator from Needle

Usage

There's a couple of interactions you can do with the ScriptingDefineUtility

Adding

Adding a new define symbol to the list

private void Foo()
{
    ScriptingDefineUtility.Add("Bar");
}

Removing

Removing an existing define symbol from the list

private void Foo()
{
    ScriptingDefineUtility.Remove("Bar");
}

Contains

Checking if a symbol is in the current symbols list

private void Foo()
{
    if (ScriptingDefineUtility.Contains("Bar"))
    {
        ...
    }
}

Getting

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;
}

Support

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.

ko-fi

Contributing

Pull requests are welcomed. Please feel free to fix any issues you find, or add new features.

About

a small helper that allows you to more easily modify the scripting define symbols for your project

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages