-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Clément Couture
committed
Oct 21, 2021
1 parent
375333a
commit 0d4f0af
Showing
128 changed files
with
5,114 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.Linq; | ||
using EditorPlus; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
|
||
public class DemoScript : MonoBehaviour { | ||
|
||
[HelpBox("Try setting this to \"42\"")] | ||
public string TextToSet; | ||
|
||
[ShowIf(nameof(TextToSet), "42")] | ||
public InnerClass IAmHidden; | ||
|
||
public int[] IntValues; | ||
|
||
#if UNITY_EDITOR | ||
[OnEditorGUI] | ||
private void SumInEditor() { | ||
int sum = IntValues?.Sum() ?? 0; | ||
EditorGUILayout.LabelField($"The sum of all the elements in the {nameof(IntValues)} list is {sum}"); | ||
} | ||
#endif | ||
|
||
[Button] | ||
public void SetText() { | ||
GetComponent<TextMesh>().text = TextToSet; | ||
} | ||
|
||
[Serializable] | ||
public class InnerClass { | ||
|
||
[Disabled] | ||
public int NoOneCanEditThis = 2; | ||
|
||
[CustomSpace(20, 20)] | ||
[MinMaxSlider(-42, 42)] | ||
public MinMaxInt INeedSomeSpace; | ||
|
||
[HideInPlayMode] | ||
public string LookAtMe; | ||
|
||
[HideInEditMode] | ||
public string SURPRISE = "SURPRISE"; | ||
|
||
[DisableInEditMode] | ||
public string AndTryPressingPlay; | ||
|
||
[Button("Display List Of Subclasses Of Component")] | ||
private void DisplayListOfSubclassesOfComponent() { | ||
Type targetType = typeof(Component); | ||
Debug.Log($"All the sub-classes of {nameof(targetType)} are " + | ||
$"{string.Join(", ", TypeUtils.GetAllTypesInheritingFrom(targetType).Select(t => t.Name))}"); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.