Skip to content

Commit 040f5f5

Browse files
committed
Echo button with the right way of using JCSUnity GUI system.
1 parent 03077cf commit 040f5f5

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Assets/JCSUnity/Scripts/GUI/JCS_Buttons/JCS_EchoButton.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,22 @@ namespace JCSUnity
1818
/// button triggered.
1919
/// </summary>
2020
public class JCS_EchoButton
21-
: JCS_Button
21+
: JCS_Button
2222
{
2323
[Header("** Runtime Variables (JCS_EchoButton) **")]
2424

2525
[Tooltip("String to echo out on the console window.")]
2626
public string echoString = "echo Hello World!~";
2727

28-
/// <summary>
29-
/// Default function to call this, so we dont have to
30-
/// search the function depends on name.
31-
///
32-
/// * Good for organize code and game data file in Unity.
33-
/// </summary>
34-
public override void JCS_ButtonClick()
28+
protected override void Awake()
3529
{
36-
base.JCS_ButtonClick();
30+
base.Awake();
3731

32+
SetCallback(OnClick);
33+
}
34+
35+
private void OnClick()
36+
{
3837
JCS_Debug.Log(echoString);
3938
}
4039
}

0 commit comments

Comments
 (0)