Introduction
What´s Cowsins Inspector?
Cowsins Inspector is a powerful attribute-based tool that enhances Unity Inspectors organize and structure them properly, as well as making them visually appealing.
Say goodbye to messy inspectors and hello to a more beautiful and user-friendly Unity experience!
What to know?
As mentioned earlier, Cowsins Inspector is attribute-based. But what exactly is an attribute?
An attribute modifies how classes, variables or methods behave or are displayed in the Inspector.
Unity includes several built-in attributes, such as [SerializeField] and [Header], but Cowsins Inspector allows a deeper customization including a range of handy attributes, See an example:
[Title("Hello")]
public bool myVariable;
Attributes can be stacked.
[Spacing(15)]
[Title("Hello")]
public bool myVariable;
For easier and better readibility, you can stack attributes as shown:
[Spacing(15),Title("Hello")]
public bool myVariable;
Recommendations
To get the most out of Cowsins Inspector, it's beneficial to have a basic understanding of C# programming. This includes knowledge of defining public and private variables, creating methods, and other fundamental concepts. Below is a brief guide to help you get started if you're not familiar with these aspects.
Basic Concepts of C# in Unity
Public vs. Private Variables:
Public variables are accessible from other classes and are often used for values you want to modify in the Unity Inspector.
Private variables are only accessible within the class where they are declared, keeping them hidden from other classes and the Inspector.
public int score; // Accessible to external classes and visible in the Inspector
private float speed; // Can only be accessed and modified within the class
PRO TIP: Do you want to have a private variable visible in the Inspector? Try the [SerializeField] attribute provided by Unity.
[SerializeField]
private float speed; // Visible in the inspector, only accessable within the class
Methods
Methods are functions defined within a class that execute specific actions. They can also be public or private. Public methods can be called from other classes or scripts, while private methods can only be used within the same class.
public void Move()
{
// Your code goes here, between the brackets
}
private void Jump()
{
// Your code goes here, between the brackets
}
Last updated