Skip to content

Commit

Permalink
Add package manifest for UPM, Add package documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
excalith committed Sep 22, 2020
1 parent 388d8b0 commit 9a6bb7f
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 13 deletions.
8 changes: 8 additions & 0 deletions Assets/Plugins/Excalith/Observer/Documentation.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

138 changes: 138 additions & 0 deletions Assets/Plugins/Excalith/Observer/Documentation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Unity Observer
### Observer Editor Window

An editor window to invoke methods, observe values and change them on editor play mode.


## Usage
- You can open Observer window through `Window > Tools > Observer`
- Requires `Excalith.Observer` namespace

| Function | Argument 1 | Argument 2 | Argument 3 |
| ------------------ | ----------------- | -------------------- | --------------- |
| Observer.Log | `string` Category | `string` DisplayName | `object` Object |
| Observer.Value | `string` Category | `string` DisplayName | `object` Object |
| Observer.Button | `string` Category | `string` DisplayName | `object` Object |
| Observer.Header | `string` Category | `string` DisplayName | `string` Title |
| Observer.Seperator | `string` Category | | |
---

### Log Method
Registers a value to watch over. To update values, call corresponding function again.

```C
Observer.Log("Log Examples", "String Value", "Test String");
Observer.Log("Log Examples", "Boolean Value", true);
Observer.Log("Log Examples", "Int Value", 150);
Observer.Log("Log Examples", "Float Value", 1.50f);
Observer.Log("Log Examples", "Double Value", 1.50);
Observer.Log("Log Examples", "Vector2 Value", new Vector2(2,2));
Observer.Log("Log Examples", "Vector3 Value", new Vector3(2, 2, 2));
Observer.Log("Log Examples", "Color Value", new Color(128, 128, 128));
Observer.Log("Log Examples", "Enum Value", MyEnum.MyValue);
```

---

### Value Method
> FYI: This should be only used within editor for testing purposes
Registers a value and allows you to update it through editor. Unsupported objects will be shown as "Unsupported Type".

```C
// Boolean Example
Observer.Value("Update Examples", "Boolean Type", m_BoolTest, (object val) =>
{
m_BoolTest = (bool)val;
});

// String Example
Observer.Value("Update Examples", "String Type", m_StringTest, (object val) =>
{
m_StringTest = (string)val;
});

// Integer Example
Observer.Value("Update Examples", "Integer Type", m_IntTest, (object val) =>
{
m_IntTest = (int)val;
});

// Float Example
Observer.Value("Update Examples", "Float Type", m_FloatTest, (object val) =>
{
m_FloatTest = (float)val;
});

// Double Example
Observer.Value("Update Examples", "Double Type", m_DoubleTest, (object val) =>
{
m_DoubleTest = (double)val;
});

// Vector2 Example
Observer.Value("Update Examples", "Vector2 Type", m_Vec2Test, (object val) =>
{
m_Vec2Test = (Vector2)val;
});

// Vector3 Example
Observer.Value("Update Examples", "Vector3 Type", m_Vec3Test, (object val) =>
{
m_Vec3Test = (Vector3)val;
});

// Color Example
Observer.Value("Update Examples", "Color Type", m_ColorTest, (object val) =>
{
m_ColorTest = (Color)val;
});

// Enum Example
Observer.Value("Update Examples", "Enum Type", m_EnumTest, (object val) =>
{
m_EnumTest = (ObserverEntryType)val;
});
```

---

#### Button Method
Registers a button and invokes given function
```C
Observer.Button("Button Examples", "Function Call Button", TestFunction);
```

```C
Observer.Button("Button Examples", "Anonymous Call Button", () =>
{
Debug.Log("Hello, World!");
});
```

---

#### Header Method
Creates a space with a title
```C
Observer.Header("Update Examples", "Header Example");
```

---

#### Seperator Method
Creates an empty space
```C
Observer.Seperator("Update Examples");
```

## Contribution
Please feel free to contribute!

- Create issues for both issues and feature requests
- Create pull requests to develop for anything listed in issues
- Please use prefixes such as Add, Fix, Update etc. before your commit message
- Please be brief about your commit message


## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
7 changes: 7 additions & 0 deletions Assets/Plugins/Excalith/Observer/Documentation/README.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Plugins/Excalith/Observer/Samples/DemoScene.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using UnityEngine;

namespace Excalith.Observer.Examples
namespace Excalith.Observer.Samples
{
public class ObserverExamples : MonoBehaviour
public class ObserverSamples : MonoBehaviour
{
private string m_StringTest = "Test Value";
private bool m_BoolTest = true;
Expand Down
21 changes: 21 additions & 0 deletions Assets/Plugins/Excalith/Observer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "com.excalith.unity-observer",
"displayName": "Unity Observer",
"version": "0.9.1",
"unity": "2017.4",
"description": "An editor window to invoke methods, observe values and change them on editor play mode.",
"author": {
"name": "Can Cellek",
"url": "https://cancellek.com"
},
"keywords": [ "editor", "window", "debug", "log", "observer" ],
"category": "editor extensions",
"dependencies": {},
"samples": [
{
"displayName": "Sample Scene",
"description": "Scene with Unity Observer package usage examples",
"path": "Samples~/DemoScene"
}
]
}
7 changes: 7 additions & 0 deletions Assets/Plugins/Excalith/Observer/package.json.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Observer
### Observer Editor Tool
# Unity Observer
### Observer Editor Window

An editor window to invoke methods, observe values and change them on editor play mode.

Expand All @@ -26,15 +26,15 @@ An editor window to invoke methods, observe values and change them on editor pla
Registers a value to watch over. To update values, call corresponding function again.

```C
Observer.Log("Observe Examples", "String Value", "Test String");
Observer.Log("Observe Examples", "Boolean Value", true);
Observer.Log("Observe Examples", "Int Value", 150);
Observer.Log("Observe Examples", "Float Value", 1.50f);
Observer.Log("Observe Examples", "Double Value", 1.50);
Observer.Log("Observe Examples", "Vector2 Value", new Vector2(2,2));
Observer.Log("Observe Examples", "Vector3 Value", new Vector3(2, 2, 2));
Observer.Log("Observe Examples", "Color Value", new Color(128, 128, 128));
Observer.Log("Observe Examples", "Enum Value", MyEnum.MyValue);
Observer.Log("Log Examples", "String Value", "Test String");
Observer.Log("Log Examples", "Boolean Value", true);
Observer.Log("Log Examples", "Int Value", 150);
Observer.Log("Log Examples", "Float Value", 1.50f);
Observer.Log("Log Examples", "Double Value", 1.50);
Observer.Log("Log Examples", "Vector2 Value", new Vector2(2,2));
Observer.Log("Log Examples", "Vector3 Value", new Vector3(2, 2, 2));
Observer.Log("Log Examples", "Color Value", new Color(128, 128, 128));
Observer.Log("Log Examples", "Enum Value", MyEnum.MyValue);
```

---
Expand Down

0 comments on commit 9a6bb7f

Please sign in to comment.