blob: f6e299b6232258b93491a0eb314c91281ccc2e5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
using UnityEngine;
using System.Collections;
using AdvancedInspector;
[AdvancedInspector]
public class AIExample3_InspectDynamic : MonoBehaviour
{
// The inspect attribute can be binded to a function.
// This function should return true or false, if the item should be displayed or hidden.
[Inspect("InspectItem")]
public bool myVariable;
// The function can be private or public, it doesn't matter.
private bool InspectItem()
{
return displayItem;
}
private bool displayItem = true;
// In this example, the button toggle on/off the display of "myVariable".
[Inspect]
public void PressMe()
{
displayItem = !displayItem;
}
}
|