You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
592 B
C#
34 lines
592 B
C#
4 weeks ago
|
using UnityEngine;
|
||
|
|
||
|
namespace Projectiles
|
||
|
{
|
||
|
public static class UIExtensions
|
||
|
{
|
||
|
public static void SetVisibility(this CanvasGroup @this, bool value)
|
||
|
{
|
||
|
if (@this == null)
|
||
|
return;
|
||
|
|
||
|
@this.alpha = value == true ? 1f : 0f;
|
||
|
@this.interactable = value;
|
||
|
@this.blocksRaycasts = value;
|
||
|
}
|
||
|
|
||
|
public static void SetTextSafe(this TMPro.TextMeshProUGUI @this, string text)
|
||
|
{
|
||
|
if (@this == null)
|
||
|
return;
|
||
|
|
||
|
@this.text = text;
|
||
|
}
|
||
|
|
||
|
public static string GetTextSafe(this TMPro.TextMeshProUGUI @this)
|
||
|
{
|
||
|
if (@this == null)
|
||
|
return null;
|
||
|
|
||
|
return @this.text;
|
||
|
}
|
||
|
}
|
||
|
}
|