Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/ env Public

Use .env files in your Unity projects.

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

CandyCoded/env

Repository files navigation

env

Use .env files in your Unity projects.

npm

Unity Package Manager

https://docs.unity3d.com/Packages/com.unity.package-manager-ui@2.0/manual/index.html

Git

{
 "dependencies": {
 "xyz.candycoded.env": "https://github.com/CandyCoded/env.git#v1.1.5",
 ...
 }
}

Scoped UPM Registry

{
 "dependencies": {
 "xyz.candycoded.env": "1.1.5",
 ...
 },
 "scopedRegistries": [
 {
 "name": "candycoded",
 "url": "https://registry.npmjs.com",
 "scopes": ["xyz.candycoded"]
 }
 ]
}

Usage

Create a .env file at the root of your project, outside of the Assets/ folder, and paste the following content:

DEBUG=true

Or use the Editor panel found by navigating to Window > CandyCoded > Environment File Editor.

Note: Don't forget to add .env to your .gitignore file before committing any changes!

Now you can reference the variables and their values with the key specified in the .env file. Supported value types are string, bool, double, float, and int.

if (env.TryParseEnvironmentVariable("DEBUG", out bool isDebug))
{
 Debug.Log($"Debug Mode is: {(isDebug ? "ON" : "OFF")}");
}

About

Use .env files in your Unity projects.

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

Languages

AltStyle によって変換されたページ (->オリジナル) /