UIView
Code examples to show, hide and perform various interactions with the UIView
Cancel Auto Hide
Cancel an auto hide, if it was initiated
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public UIView View; private void Start() { View.CancelAutoHide(); } }
Hide View
Hide an UIView
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public UIView View; private void Start() { View.Hide(); } }
Hide View – instantly (without animation)
Hide an UIView instantly without playing the hide animation.
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public UIView View; private void Start() { View.Hide(true); } }
Hide View – after a set delay (Auto Hide)
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public UIView View; public float HideDelay = 5f; // 5 seconds hide delay private void Start() { View.Hide(HideDelay); } }
Show View
Show an UIView
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public UIView View; private void Start() { View.Show(); } }
Show View – instantly (without animation)
Show an UIView instantly without playing the show animation.
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public UIView View; private void Start() { View.Show(true); } }
Start Loop Animation
Start the loop animations set up on the target UIView. The animation will start only it at least one tween (move, rotate, scale and/or fade) is enabled.
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public UIView View; private void Start() { View.StartLoopAnimation(); } }
Stop Loop Animation
Stop any running loop animations on the target UIView.
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public UIView View; private void Start() { View.StopLoopAnimation(); } }
Toggle View
Toggle the target UIView by showing it if it’s NOT visible or hiding it otherwise.
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public UIView View; private void Start() { View.Toggle(); } }
Toggle View – instantly (without animation)
Toggle the target UIView, instantly without playing the animation, by showing it if it’s NOT visible or hiding it otherwise.
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public UIView View; private void Start() { View.Toggle(true); } }
GLOBAL – Get Views
Get a list of all the ~UIViews~, registered in the UIView.Database, with the given view category and view name. If no UIView is found, an empty list will get returned.
using System.Collections.Generic; using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public string ViewCategory = "MyCategory"; public string ViewName = "MyViewName"; private void Start() { List<UIView> views = UIView.GetViews(ViewCategory, ViewName); Debug.Log("Found " + views.Count + " views in the UIView.Database, that have the '" + ViewCategory + "' view category and '" + ViewName + "' view name"); } }
GLOBAL – Get Visible Views
Get a list of all the ~UIViews~ that are visible on screen.
using System.Collections.Generic; using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { private void Start() { List<UIView> views = new List<UIView>(UIView.VisibleViews); Debug.Log(views.Count + " views are currently visible on screen"); } }
GLOBAL – Hide View
Hide all the ~UIViews~ with the passed view category and view name. Note that if an UIView view category and view name are set to the default values, the HIDE animation will NOT play.
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public string ViewCategory = "MyCategory"; public string ViewName = "MyViewName"; private void Start() { UIView.HideView(ViewCategory, ViewName); } }
GLOBAL – Hide View? – instantly (without animation)
Hide all the ~UIViews~ with the passed view category and view name, instantly without playing the hide animation. Note that if an UIView view category and view name are set to the default values, the HIDE animation will NOT play.
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public string ViewCategory = "MyCategory"; public string ViewName = "MyViewName"; private void Start() { UIView.HideView(ViewCategory, ViewName, true); } }
GLOBAL – Is View Visible
Returns TRUE if at least one UIView, with the passed view category and view name, is visible. An UIView is considered visible if its IsVisible value is true and if it has been added to the VisibleViews list.
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public string ViewCategory = "MyCategory"; public string ViewName = "MyViewName"; private void Start() { bool isVisible = UIView.IsViewVisible(ViewCategory, ViewName); Debug.Log("The UIView with the '" + ViewCategory + "' view category and '" + ViewName + "' view name is " + (isVisible ? "" : "NOT") + " visible"); } }
GLOBAL – Show View
Show all the ~UIViews~ with the passed view category and view name. Note that if an UIView view category and view name are set to the default values, the SHOW animation will NOT play.
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public string ViewCategory = "MyCategory"; public string ViewName = "MyViewName"; private void Start() { UIView.ShowView(ViewCategory, ViewName); } }
GLOBAL – Show View? – instantly (without animation)
Show all the ~UIViews~ with the passed view category and view name, instantly without playing the show animation. Note that if an UIView view category and view name are set to the default values, the SHOW animation will NOT play.
using Doozy.Engine.UI; using UnityEngine; public class ExampleClass : MonoBehaviour { public string ViewCategory = "MyCategory"; public string ViewName = "MyViewName"; private void Start() { UIView.ShowView(ViewCategory, ViewName, true); } }