Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/DarrenTsung/DTCommandPalette
Command palette for Unity - run methods, open scenes, and more!
https://github.com/DarrenTsung/DTCommandPalette
Last synced: 3 months ago
JSON representation
Command palette for Unity - run methods, open scenes, and more!
- Host: GitHub
- URL: https://github.com/DarrenTsung/DTCommandPalette
- Owner: DarrenTsung
- License: mit
- Created: 2017-01-23T22:38:35.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-22T17:36:35.000Z (over 7 years ago)
- Last Synced: 2024-08-02T05:13:01.173Z (6 months ago)
- Language: C#
- Size: 3.78 MB
- Stars: 20
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-unity-open-source-on-github - DTCommandPalette - Command palette for Unity (Command)
README
# DTCommandPalette
Command palette for Unity - run methods, open scenes, and more!### To install:
Clone the git repository and add the entire folder to your Unity project.### Supported Versions:
Tested on Unity 5.4. It will probably work on other similar versions..### Features:
Open..`%t (Cmd-T on Mac / Control-T on Windows)`
* Open Scenes
* Select GameObjects in the Scene
* Open Prefabs into a sandbox scene (requires [PrefabSandbox](https://github.com/DarrenTsung/DTPrefabSandbox))![CommandPaletteScreenshot](CommandPaletteScreenshot.png)
Command Palette
`%#m (Cmd-Shift-M on Mac / Control-Shift-M on Windows)`
* Run commands (any method with [MethodCommand] attribute can be run)![CommandPaletteShowoff](CommandPaletteShowoff.gif)
Example (C#):
```csharp
using DTCommandPalette;
using UnityEngine;public static class ExampleClass {
[MethodCommand]
public static void DeletePlayerPrefs() {
PlayerPrefs.DeleteAll();
}
}public class ExampleMonoBehaviour : MonoBehaviour {
[SerializeField] private Image _image;// This method command will only appear if
// the currently selected GameObject has an
// ExampleMonoBehaviour on it
[MethodCommand]
public void TurnYellow() {
_image.color = Color.yellow;
}
}
```### Extending CommandPalette and Dependencies
To help external developers with extending CommandPalette by writing their own specific ICommands, DTCommandPalette injects a compile flag named DT_COMMAND_PALETTE into your project automatically that you can use to wrap your extension classes.This means that you can write your code and have it be a soft (optional) dependency on DTCommandPalette instead of requiring DTCommandPalette to be imported into the project.
Example (C#):
```csharp
using UnityEngine;#if DT_COMMAND_PALETTE
using DTCommandPalette;
#endifpublic static class ExampleClass {
#if DT_COMMAND_PALETTE
[MethodCommand]
#endif
public static void DeletePlayerPrefs() {
PlayerPrefs.DeleteAll();
}
}
```