Skip to content

Commit

Permalink
feat(UI/Canvas): Add toggle visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Dec 10, 2024
1 parent 7a70beb commit 45cd625
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Assets/JCSUnity/Scripts/UI/JCS_Canvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ public void Hide(bool mute = false)
JCS_SoundPlayer.PlayByAttachment(mActiveSound, JCS_SoundMethod.PLAY_SOUND);
}

/// <summary>
/// Toggle the canvas' visibility.
/// </summary>
/// <param name="mute"> True to mute the sound. </param>
public void ToggleVisibility(bool mute = false)
{
if (mCanvas.enabled)
Hide(mute);
else
Show(mute);
}

/// <summary>
/// Prompt warning if there are multiple main canvases in the scene.
/// </summary>
Expand Down

0 comments on commit 45cd625

Please sign in to comment.