Skip to content

danliukuri/Vector4CompactDrawer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Banner

Overview

A custom Unity property drawer designed to optimize the inspector view for Vector4 fields. It reduces the space taken by the default layout, offering a cleaner, more compact design without sacrificing functionality.

Features

  • Compact Layout: Displays Vector4 fields in a condensed format, optimizing space in the inspector
  • Prefab Support: Correctly handles prefab instances and variants, ensuring changes are tracked and displayed properly with the ability to apply/revert changes
  • No Configuration Required: Automatically applies to all Vector4 fields without requiring any additional setup or custom inspectors/attributes
  • Inspector Modes Handling: Adapts seamlessly to both wide and compact inspector modes,
    ensuring a consistent experience
  • Custom Inspectors Support: Fully compatible with custom inspectors, allowing effortless integration into existing editor workflows

Installation

You can install the Vector4 Compact Drawer package using one of the following methods:

1. Unity Package Manager

  1. Open Unity, then go to Window -> Package Manager.
  2. Click on the dropdown and select Add package from git URL...
  3. Paste the following URL and click Add:
https://github.com/danliukuri/Vector4CompactDrawer.git?path=Vector4CompactDrawer.Unity/Assets/Plugins/Vector4CompactDrawer

2. Download From Releases

  1. Go to the Releases Page.
  2. Download the desired package(s):
    • Core package: Vector4CompactDrawer@vX.X.X.unitypackage
    • Samples (optional): Vector4CompactDrawer.Samples@vX.X.X.unitypackage
  3. Import the package(s) into your Unity project.

Usage

Once installed, the Vector4 Compact Drawer will automatically apply to all Vector4 fields in your scripts. No additional configuration is required.

See the Showcase sample for simple usage demonstration.

Samples

To demonstrate the capabilities of the Vector4 Compact Drawer, following samples have been created.

Showcase

To see the compact drawer in action, simple Vector4 serialized field exposing script was created:

public class Vector4Exposer : MonoBehaviour
{
    [SerializeField] private Vector4 serializedVector;
}

When you select a GameObject with this component, the Vector4 field will be displayed in a compact layout in the Unity Inspector.

Working With Prefabs

The drawer fully supports prefab instances and variants, ensuring changes are tracked and displayed correctly.

PrefabEditing

Inspector Modes

The drawer automatically adjusts based on the inspector's width (EditorGUIUtility.wideMode), ensuring a consistent user experience across different layouts:

  • Wide Mode: The drawer displays the Vector4 field in a single-line layout: WideMode

  • Compact Mode: The field is split across two lines to maintain readability while conserving space: CompactMode

Contribution

Feel free to submit issues or pull requests to improve this package.