Skip to content

smeas/Unity-Editor-Utilities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Unity Editor Utilities

A collection of utilities for Unity.

Content

Attributes

Conditional (link)

Attributes allowing you to hide/disable serialized fields depending on the values of other fields. Note that it currently only supports checking other fields. Property and method support might be added in the future.

Conditional attributes demo

Usage

public Mode mode;

[ShowIf(nameof(mode), Mode.Random)] // Equality
public float randomWeight;

public bool enableAdvancedSettings;

[EnableIf(nameof(enableAdvancedSettings))]
public int timeout;

[EnableIf(nameof(enableAdvancedSettings), Invert = true)] // Inverted
public int inverted;

Tag (link)

Displays a tag selection dropdown for a string field.

Features

  • Warns on missing tags (yellow tint)
  • Manual string entry (right click)

Usage

[Tag]
public string someTag;

Display Name (link)

Changes the display name of a field in the inspector.

Usage

[DisplayName("Other Name")]
public float someName; // Will be displayed as "Other Name" in the inspector

Read Only (link)

Makes a field read-only in the inspector. Useful for displaying debug information that the user is not supposed to edit.

Usage

[ReadOnly]
public float currentValue;

Min Max Range (link)

Displays a min/max slider for a Vector2 field.

Usage

[MinMaxRange(0, 10)]
public Vector2 range;

Unit (link)

Draws a little string in the right of a number or string field in the inspector. Useful for indicating in what unit a value is.

Usage

[Unit("kg")]
public float weight;

[Unit("m/s")]
public float maxSpeed;

[Unit("m/s^2")]
public float acceleration;

Enum Named Array (link)

Used on an array to give its elements names from an enum.

Usage

[EnumNamedArray(typeof(Fruits))]
public string[] fruitIds;

public enum Fruits {
    Apple,
    Orange,
    Banana,
}

Other

Scene Reference (link)

A utility type that holds a safe reference to a scene.

Scene reference demo

Features

  • Rename scenes without needing to update references
  • Warns you if a selected scene is not in the build settings
  • Easily add/remove scenes from build settings right in the inspector
  • No runtime overhead (in builds)

Usage

public SceneReference myScene;

private void Start() {
    myScene.Load();
    // Or
    SceneManager.Load(myScene); // Implicit cast to int (build index)
}

Collider Visualizer (link)

A tool to vizualize all the colliders and triggers in the scene.

Found under the "Tools/Collider Vizualizer" menu.

Features

  • Displays colliders and triggers
  • Makes colliders selectable
  • Filtering by layer or tag

Limitations

  • Can not render convex mesh collider, it will render the normal mesh instead
  • Some colliders like capsules and meshes have no fill color, and cannot be selected

About

A collection of single file editor utilities for Unity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages