Skip to content

Commit 5eca08b

Browse files
committed
Update Example.cs
1 parent f719b18 commit 5eca08b

File tree

1 file changed

+33
-33
lines changed
  • Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Example/ExampleAssets/Scripts/Runtime

1 file changed

+33
-33
lines changed

Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Example/ExampleAssets/Scripts/Runtime/Example.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,64 +8,64 @@
88

99
namespace MackySoft.SerializeReferenceExtensions.Example {
1010

11-
public class Example : MonoBehaviour {
11+
public class Example : MonoBehaviour {
1212

13-
// The type that implements ICommand will be displayed in the popup.
14-
[SerializeReference, SubclassSelector]
15-
ICommand m_Command;
13+
// The type that implements ICommand will be displayed in the popup.
14+
[SerializeReference, SubclassSelector]
15+
ICommand m_Command;
1616

17-
// Collection support
18-
[SerializeReference, SubclassSelector]
19-
ICommand[] m_Commands = Array.Empty<ICommand>();
17+
// Collection support
18+
[SerializeReference, SubclassSelector]
19+
ICommand[] m_Commands = Array.Empty<ICommand>();
2020

2121
void Start () {
22-
m_Command?.Execute();
22+
m_Command?.Execute();
2323

24-
foreach (ICommand command in m_Commands) {
25-
command?.Execute();
24+
foreach (ICommand command in m_Commands) {
25+
command?.Execute();
2626
}
2727
}
2828

29-
// Nested type support
29+
// Nested type support
3030
[Serializable]
31-
public class NestedCommand : ICommand {
32-
public void Execute () {
33-
Debug.Log("Execute NestedCommand");
31+
public class NestedCommand : ICommand {
32+
public void Execute () {
33+
Debug.Log("Execute NestedCommand");
3434
}
3535
}
3636

37-
}
37+
}
3838

39-
public interface ICommand {
40-
void Execute ();
39+
public interface ICommand {
40+
void Execute ();
4141
}
4242

43-
[Serializable]
44-
public class DebugCommand : ICommand {
45-
[SerializeField]
46-
string m_Message;
47-
public void Execute () {
48-
Debug.Log(m_Message);
43+
[Serializable]
44+
public class DebugCommand : ICommand {
45+
[SerializeField]
46+
string m_Message;
47+
public void Execute () {
48+
Debug.Log(m_Message);
4949
}
5050
}
5151

52-
[Serializable]
53-
public class InstantiateCommand : ICommand {
52+
[Serializable]
53+
public class InstantiateCommand : ICommand {
5454

55-
[SerializeField]
55+
[SerializeField]
5656
GameObject m_Prefab;
5757

5858
public void Execute () {
59-
UnityEngine.Object.Instantiate(m_Prefab,Vector3.zero,Quaternion.identity);
59+
UnityEngine.Object.Instantiate(m_Prefab,Vector3.zero,Quaternion.identity);
6060
}
6161
}
6262

63-
// Menu override support
64-
[AddTypeMenu("Example/Add Type Menu Command")]
65-
[Serializable]
66-
public class AddTypeMenuCommand : ICommand {
67-
public void Execute () {
68-
Debug.Log("Execute AddTypeMenuCommand");
63+
// Menu override support
64+
[AddTypeMenu("Example/Add Type Menu Command")]
65+
[Serializable]
66+
public class AddTypeMenuCommand : ICommand {
67+
public void Execute () {
68+
Debug.Log("Execute AddTypeMenuCommand");
6969
}
7070
}
7171

0 commit comments

Comments
 (0)