Skip to content

slavniyteo/one-line

Repository files navigation

Overview

OneLine provides a simple way to organize your databases without writing dozens of boilerplate code. It draws objects in Inspector into one line instead default line-by-line style. Also it provides a few features like field highlightning, locking array size, etc...

Read about OneLine on habr: 1, 2 (ru).

Full Reference is here.

Unity Asset Store GitHub release GitHub Release Date Github commits (since latest release) GitHub last commit

News

  • 2019.08.20: Added how to build instruction here on request 39.

  • 2019.08.08: v0.5.0 released! Added UPM Support.

  • 2019.01.15: v0.4.0 released!

  • 2018.03.01: v0.3.0 released!

  • 2018.02.27: Added [Expandable] attribute. See full documentation and #22

  • 2018.02.26: Added custom property drawers support.
    Now any custom drawer, which returns height < 20, is drown. Acceptable for custom drawers of either types or attributes.

  • 2018.02.18: Available on the Asset Store for free.

TL;DR

  • After importing look at Documentation~/Examples/Overview/Overview.asset (see the screenshot below) and open it in InspectorWindow. It'll show you all capabilities of the library;
  • In your code, add using OneLine; and [OneLine] to fields you want to draw into one line. Note that internal fields don't need [OneLine]: they are processed automatically;
  • IToo customize onelined fields, use Width, Weight, HideLabel, Highlight, HideButtons and ArrayLength attributes (see Example.asset);
  • Use Separator attribute to separate different fields;
  • Use Expandable attribute to follow object references (real street magic is here) (idea is stolen from here;
  • OneLine uses RectEx, so feel free to try it.
  • Compatible with either .Net 2.0 or .Net 4.5 backends.

Overview

Code of the screenshot above is here.

Installation

Versions prior v0.5.0 are available at Unity Asset Store.

Since v0.5.0 One Line is managed via Unity Package Manager.

To add OneLine to your Unity project, add following dependency to your manifest.json as described here and here. Use master or any version above v0.5.0 (including) because v0.4.0 and previous versions are not compatible with Unity Package Manager.

{
  "dependencies": {
    "st.rect-ex": "https://github.com/slavniyteo/rect-ex.git#master",
    "st.one-line": "https://github.com/slavniyteo/one-line.git#master"
  }
}

To be able to run tests add these lines (actually OneLine doesn't have any tests but RectEx has):

{
  "dependencies": {
    "st.rect-ex": "https://github.com/slavniyteo/rect-ex.git#master",
    "st.one-line": "https://github.com/slavniyteo/one-line.git#master"
  },
  "testables": [
    "st.rect-ex",
    "st.one-line"
  ]
}

Edit OneLine Project

Added on request 39.

When you add OneLine via UPM as described above, it becomes readonly. To be able to edit OneLine, you should add it to project as local dependency:

  1. Clone repository to local directory:
git clone https://github.com/slavniyteo/one-line /home/user/projects/one-line
  1. In your working project add dependency to cloned OneLine:
{
  "dependencies": {
    "st.rect-ex": "https://github.com/slavniyteo/rect-ex.git#master",
    "st.one-line": "file:/home/user/projects/one-line"
  }
}

On Windows:

{
  "dependencies": {
    "st.rect-ex": "https://github.com/slavniyteo/rect-ex.git#master",
    "st.one-line": "file:D:/projects/one-line"
  }
}

Note that RectEx is git dependency.

It's all. OneLine becomes editable at InspectorWindow when your working project is open. Besides you can edit scripts of OneLine and they'll be compiled with our project.