Skip to content

Performant and easy to use UI tweening and management system for Unity

License

Notifications You must be signed in to change notification settings

GloriousPtr/EZUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EZUI: UI Solution for Unity

Build Status CodeFactor

Unity GitHub Size

Sample

Unity Animation system is not meant to work with UI. The problem here is if one panel is updated every child and subsequent children in the tree which must be UI element (quad) are marked dirty. This leads to poor performance because of the resubmission each frame CPU has to do and Unity Animation system does this even when animations are not running.

The solution to this is using tweens. So I created this project along with UI Management features (Panels, Popups, back stack, and many more)

Features

  • Easy To Use UI Solution.
  • Uses DOTween for UI animations.

Demo

Check out Assets/Plugins/EZUI/Scenes/Demo.unity scene.

Documentation

Prerequisites

  • Import DOTween and set it up
  • Import EZUI.unitypackage from here
  • If using assembly definitions for DOTween, add the reference to Plugins/EZUI/Scripts/EZUI.Core.asmdef

Setting Up

  • In Hierarchy, Right Click→EZUI→EZUIManager.
  • In project window, Right Click→Create→EZUI→EZUIData.
  • Assign newly created EZUIData to EZUIManager→Data.
  • Each canvas should be assigned to EZUIManager>UIModules list for the system to work correctly.
  • Now EZUI→EZUIPanel or EZUI→EZUIPopup can be created inside their respective canvas.

Video Tutorial

EZUI

API Documentation

The API is exposed through EZUIManager.Instance which is a singleton.

/// <summary>
/// Shows the Page and add to stack
/// </summary>
/// <param name="key">Page key</param>
EZUIManager.Instance.ShowPage(string key);

/// <summary>
/// Shows the Page and add to stack
/// </summary>
/// <param name="key">Page key</param>
/// <param name="immediate">true- no animations, false- with animations</param>
EZUIManager.Instance.ShowPage(string key, bool immediate);

/// <summary>
/// Shows the Popup and add to stack
/// </summary>
/// <param name="key">Popup key</param>
EZUIManager.Instance.ShowPopup(string key);

/// <summary>
/// Shows the Popup and add to stack
/// </summary>
/// <param name="key">Popup key</param>
/// <param name="immediate">true- no animations, false- with animations</param>
EZUIManager.Instance.ShowPopup(string key, bool immediate);

/// <summary>
/// Shows the Popup and add to stack
/// </summary>
/// <param name="popup">Popup object</param>
/// <param name="immediate">true- no animations, false- with animations</param>
EZUIManager.Instance.ShowPopup(EZUIPopup popup, bool immediate);

/// <summary>
/// Hides the Popup and remove from stack
/// </summary>
/// <param name="key">Popup key</param>
EZUIManager.Instance.HidePopup(string key);

/// <summary>
/// Hides the Popup and remove from stack
/// </summary>
/// <param name="key">Popup key</param>
/// <param name="immediate">true- no animations, false- with animations</param>
EZUIManager.Instance.HidePopup(string key, bool immediate);

/// <summary>
/// Hides the Popup and remove from stack
/// </summary>
/// <param name="popup">Popup object</param>
/// <param name="immediate">true- no animations, false- with animations</param>
EZUIManager.Instance.HidePopup(EZUIPopup popup, bool immediate);

/// <summary>
/// Hide All the Popups and Pages and clear the stack
/// </summary>
/// <param name="immediate">true- no animations, false- with animations</param>
EZUIManager.Instance.HideAllAndClearStack(bool immediate)

/// <summary>
/// Go back once, Precedence: Popup > Page
/// Also removes the current Popup/Page from stack
/// </summary>
EZUIManager.Instance.GoBack();