-
-
Save neo-mashiro/7e03247557874e45f3d02d76e20cc4e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
[HelpURL("http://unity3d.college")] | |
[SelectionBase] | |
public class MyClass : MonoBehaviour | |
{ | |
[Header("Text Attributes")] | |
[TextArea] | |
[Tooltip("A string using the TextArea attribute")] | |
[SerializeField] | |
private string descriptionTextArea; | |
[Multiline] | |
[Tooltip("A string using the MultiLine attribute")] | |
[SerializeField] | |
private string descriptionMultiLine; | |
[Header("Numeric Attributes")] | |
[Tooltip("A float using the Range attribute")] | |
[Range(-5f, 5f)] | |
[SerializeField] | |
private float rangedFloat; | |
[Space] | |
[Tooltip("An integer using the Range attribute")] | |
[Range(-5, 5)] | |
[SerializeField] | |
private int rangedInt; | |
[Header("Color Attributes")] | |
[SerializeField] | |
private Color colorNormal; | |
[ColorUsage(false)] | |
[SerializeField] | |
private Color colorNoAlpha; | |
[ColorUsage(true, true, 0.0f, 0.5f, 0.0f, 0.5f)] | |
[SerializeField] | |
private Color colorHdr; | |
[ContextMenu("Choose Random Values")] | |
private void ChooseRandomValues() | |
{ | |
rangedFloat = Random.Range(-5f, 5f); | |
rangedInt = Random.Range(-5, 5); | |
} | |
[Header("Context Menu Items")] | |
[ContextMenuItem("RandomValue", "RandomizeValueFromRightClick")] | |
[SerializeField] | |
private float randomValue; | |
private void RandomizeValueFromRightClick() | |
{ | |
randomValue = Random.Range(-5f, 5f); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment