GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Voltstro-Studios/UnityCommandLineParser: Simple command line argument parser for Unity

BranchesTags
Open more actions menu

Latest commit

 

History

43 Commits
43 Commits

Folders and files

NameName
Last commit message
Last commit date
Runtime
Runtime
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.npmrc
.npmrc
 
 
LICENSE.md
LICENSE.md
 
 
LICENSE.md.meta
LICENSE.md.meta
 
 
README.md
README.md
 
 
README.md.meta
README.md.meta
 
 
Runtime.meta
Runtime.meta
 
 
package.json
package.json
 
 
package.json.meta
package.json.meta
 
 
thirdpartycredits.txt
thirdpartycredits.txt
 
 
thirdpartycredits.txt.meta
thirdpartycredits.txt.meta
 
 

Repository files navigation

UnityCommandLineParser

License Discord YouTube

A command line parser for Unity.

One of the issues that plague most C# command line parsers is that they are designed to be run from Program.Main(string[] args); and basically take over as the entry point of your C# app. However, Unity doesn't have the standard C# entry point. So we created this project, a command line parser for Unity that is easy to use.

This project uses McMaster.Extensions.CommandLineUtils as its underlying parsing library and provides attributes to mark fields that can be filled out by an argument. You can use any field type that CommandLineUtils supports by default.

Features

  • Parses launch arguments when the player is launched.
  • Supports commands and arguments

Getting Started

Package Installation

Prerequisites

Unity 2020.3.x

Installation Methods

There are three main sources on how you can install this package. Pick which ever one suites you the best!

Voltstro UPM

You can install this package from our custom UPM registry. To setup our registry, see here.

Once you have the registry added to your project, you can install it like any other package via the package manager.

OpenUPM

You can install this package via OpenUPM.

To install it, use their CLI:

openupm-cli add dev.voltstro.unitycommandlineparser

Git

To install it via the package manager with git you will need to:

  1. Setup UnityNuGet
  2. Open up the package manager via Windows -> Package Manager
  3. Click on the little + sign -> Add package from git URL...
  4. Type https://github.com/Voltstro-Studios/UnityCommandLineParser.git and add it
  5. Unity will now download and install the package

Please note that you will have to manually check for updates, and replace the hash (or tag version) in your project's packages-lock.json file.

Usage

Mark a static field with a [CommandLineArgument] attribute to be able to be set as a command line argument.

Or you can mark a static method with a [CommandLineCommand] attribute to be able to run a method as a command line argument.

Examples

[CommandLineArgument("name", "Sets the name of the player")]
public static string Name = "Voltstro";

[CommandLineArgument("fps", "Sets the fps of the game.")]
public static int Fps = 60;

[CommandLineCommand("weapons", "Adds all default weapons to the player on load")]
public static void AddDefaultWeapons()
{
     //Do some cool stuff
}

If this example was to be run with the commands: ./UnityPlayer -fps 420 -name "EternalClickbait Suxs" -weapons, it would set the Fps variable to 420, set the Name variable to EternalClickbait Suxs and run the method AddDefaultWeapons() on startup.

Authors

Voltstro - Initial Work - Voltstro

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

Simple command line argument parser for Unity

Topics

commandlineparsercsharpunityunity-packageunity-scriptunity-scriptsunity2dunity3d

Resources

Readme
MIT license
Activity
Custom properties

Stars

44 stars

Watchers

2 watching

Forks

5 forks
Report repository

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.