xyz.candycoded.appsettings

1.0.0 • Public • Published

App Settings

⚙️ Get app specific settings from the OS.

npm

Unity Package Manager

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

Git

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

Scoped UPM Registry

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

Usage

Create Settings.bundle in iOS project

Note: This will have to be done on each new build so safe the .bundle file somewhere outside the Builds/ folder.

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/UserDefaults/Preferences/Preferences.html

  1. Right-click on the project in the project navigator
  2. Click New File...
  3. Search for Resources / Settings Bundle
  4. Click Next
  5. Rename the file if necessary
  6. Click Create
  7. Click on the newly created Settings.bundle/Root.plist file in the project navigator
  8. Make necessary changes

Reference the values from your app

Note: The key used is the field Identifier in the Settings.bundle/Root.plist file.

using CandyCoded.AppSettings;
using UnityEngine;

public class TestAppSettings : MonoBehaviour
{

    private void Start()
    {

        Debug.Log(AppSettings.GetFloat("version"));

    }

}

Readme

Keywords

Package Sidebar

Install

npm i xyz.candycoded.appsettings

Weekly Downloads

18

Version

1.0.0

License

MIT

Unpacked Size

10.1 kB

Total Files

19

Last publish

Collaborators

  • neogeek