Skip to content
/ MyBox Public
forked from Deadcows/MyBox

MyBox is a set of attributes, tools and extensions for Unity

License

Notifications You must be signed in to change notification settings

noclew/MyBox

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyBox

MyBox is a set of tools and extensions for Unity. 99% of it made by me over the years of work with Unity and during The Final Station development.

Most of this stuff was made for specific cases and may or may not work for you. If you want to contribute or report a bug write me to [email protected]

ECS Tools, Helper Systems and Extentions

Tools such as Logger and TimeTest

ConditionalField:

public bool WanderAround;
[ConditionalField("WanderAround")] public float WanderDistance = 5;

public AIState NextState = AIState.None;
[ConditionalField("NextState", AIState.Idle)] public float IdleTime = 5;

ConditionalField Example

DefinedValues:

[DefinedValues(1, 3, 5)]
public int AgentHeight;

DefinedValues Example

DisplayInspector:

Displays one inspector inside of another. It's handy if you'd like to store some settings in scriptable objects.

[DisplayInspector(displayScriptField:false)] to hide object field once assigned (useful for "single instance" settings)

[CreateAssetMenu]
public class AgentAIContextSettings : ScriptableObject
{
	public bool WanderAround;
	public float WanderDistance = 5;
}
[DisplayInspector]
public AgentAIContextSettings Settings;

Set displayScriptField to false (by default it's true) to hide property field once

[DisplayInspector(displayScriptField:false)]

DisplayInspector Example DisplayInspector Example2

Layer:

public class InteractiveObject : MonoBehaviour
{
	[Layer] 
	public int DefaultLayer;
}

Layer Example

MinMaxRange and RangedFloat:

by Richard Fine

RangedFloat may be used without MinMaxRange. Default is 0-1 range

public class RandomisedHealth : MonoBehaviour
{
	[MinMaxRange(80, 120)] 
	public RangedFloat Health;
	public RangedFloat Raito;
}

MinMaxRange Example

MustBeAssigned:

Previously I used a lot of Debug.Assert() in Awake to ensure that all desired values are assigned through inspector. Now I just use MustBeAssigned.

It triggers on value types with default values, null refs, empty arrays and strings

[MustBeAssigned]
public MonoBehaviour MyScript;
[MustBeAssigned]
public float MyFloat;

MustBeAssigned Example

ReadOnly:

I use it in rare cases to debug things through inspector

public float InitialHealth = 100;
[ReadOnly]
public float CurrentHealth;

ReadOnly Example

SearchableEnum:

by incredible Ryan Hipple

public float InitialHealth = 100;
[ReadOnly]
public float CurrentHealth;

SearchableEnum Example

Separator:

Decorative separator. May be with or without title

Separator Example

About

MyBox is a set of attributes, tools and extensions for Unity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%