Wajahat Karim - Game Designer | Writer | Programmer | Tea Addict

Level Menu 2D Editor

Ever wondered how beautiful Episode Select menu is developed in Angry Birds Rio Game? Or how Character Selection Sliding Menu in Temple Run is developed? Or you want to make next big hit Indie Game with a beautiful Level/Theme/Episode/Character or custom selection menu in your game?

Welcome to Level Menu 2D Editor, a Unity asset bundle for creating level selection menu in your game. As a developer, you can spend your time on being creative in making the next big hit Indie game, while Level Menu 2D Editor works out the boring parts like managing selection variables and codes, keeping track of the currently selected, next, and previous levels, animate objects while navigation, and many more.

Get hurry and download Level Menu 2D Editor from Asset Store NOW to create your lovely and beautiful level menu of game.

unity_as_badge DownloadAPK

Or scan QR Code on your android phone.

QR Code

Table of Contents

Level Menu 2D Editor - Web Demo

[WP_UnityObject src="http://wajahatkarim.com/wp-content/uploads/UnityFiles/LevelMenu2D_Editor.unity3d" width="797" height="498"/]

Back to Contents

What's New

Version 1.0

  • Added editor functionality with custom inspector for Level Menu 2D.
  • Added offline documentation PDF in the package.

Features

[ezcol_1half]

Custom Editor Functionality

Build and customize menus now in Editor - set up the items to be shown in menu with order of your items and levels directly in editor and no need to wonder how it will look at runtime. [/ezcol_1half] [ezcol_1half_end]

Major Tween Engines Support

Choose your favorite tween engine for animations and easing of your level menus. Level Menu 2D Editor comes with support of iTween, LeanTween, HOTween, and DFTween Lite. [/ezcol_1half_end] [ezcol_1half]

Code-Free Menus

Easy and intuitive creation of level selection menus - set up the items to be shown in menu with order of your items and levels with a few mouse clicks instead of hard-coding it into your levels and code. [/ezcol_1half] [ezcol_1half_end]

Multiple Orientation Support

You can have any type of menu orientation such as Horizontal, Vertical. or Custom, which makes it easy to create a suitable and matching level select menu of your game without any need of any coding. [/ezcol_1half_end] [ezcol_1half]

Level Selection Tracking

Keep track of the currently playing level or next/previous levels inside your game. Common operations like "Reload Current Level", "Go to Next Level", or "Go to any specific level" are easily implementable with just a single line of code. [/ezcol_1half] [ezcol_1half_end]

Lots of Built-in Level Transitions

Customizable transitions between the navigating levels. Move Animations with lots of easy types including Back-In, Back-Out, and many more. [/ezcol_1half_end] [ezcol_1half]

Integrate Next-Back Buttons

Integrate Next-Previous buttons instead of Swipe Gestures or Clicks easily. All you have to do it just is to reference the game objects of Next and Back Buttons. [/ezcol_1half] [ezcol_1half_end]

Source-Code Included

You want to change something in Level Menu 2D? No problem. Level Menu 2D comes with full source code, so you'll never be stuck with a DLL that you just can't change. [/ezcol_1half_end]

Back to Contents

Tutorial

Easy and intuitive creation of scene flows - set up the order of your screens and levels with a few mouseclicks instead of hard-coding it into your levels and code  

Back to Contents

Documentation

Introduction

Level Menu 2D Editor is a Unity asset bundle for creating level selection menus in your game. This reference documentation is a detailed descriptions of all features of Level Menu 2D Editor. If you just want to get a quick start, we recommend you to you to follow the tutorial at document section. You should also check the API docs for full information about the available classes and members.

Installation and General Usage Consideration

The Level Menu 2D Editor package is installed from the Unity Asset Store using the Asset Store window of unity. After you have bought the Level Menu 2D Editor package at the Unity Asset Store you can install the package into your project by clicking the Import button next to the Level Menu 2D Editor package. This will create a folder in your project: LevelMenu2D. This folder holds all the resources required for using LevelMenu2D. All classes are being delivered as source code and will be compiled by Unity. Also, other folders of tween engines for iTween, DFTween Lite, LeanTween, and HOTween will be created as well for resolving dependency issues with Level Menu 2D Editor. We opted for providing the source code instead of some precompiled DLL, so you can make the most of LevelMenu2D and integrate it smoothly into your game. You are free to extend any of the provided classes to make them work according to your specific needs. In general we tried to anticipate the most common situations where you would want more control and provided means to change the behavior of LevelMenu2D without the need to modify existing classes.

Terminology

Within this documentation we use the following terminology:
  • Item is a Unity Game Object. It can be Unity Sprite or game object with nested objects in it. Level Menu 2D uses items for creation of menus.
  • LevelMenu2D is a singleton class and Prefab object, and the whole menu can be accessed from it. It contains methods like gotoNextItem(), gotoBackItem(), indexOf(GameObject itemObject), and so on.

Creating Menu from Level Menu 2D using Unity Sprites

You begin by installing the Level Menu 2D Editor package from the Unity Asset Store into your project. The package contains a folder named LevelMenu2D which holds all required code and assets along with some other folders of tween engines. It must be noted that LevelMenu2D Editor uses iTween, DFTween Lite, HOTween, and LeanTween for animation purposes. You must import all these assets from the Asset Store to run the LevelMenu2D Editor built menu.   Also, you must have to import Singleton Perfect from Asset Store at following link. Go to LevelMenu2D menu option in Unity3D, and click on Create LevelMenu2D option as shown in following image. CreateMenu You can also drag LevelMenu2D prefab into your scene. The property inspector of LevelMenu2D will look like the image on right: Inspector
  • Insert number of items in Size attribute of Items List.
  • Drag item game objects in the Items List array.
  • Set Orientation to Horizontal or Vertical.
  • Run the game, and your menu will be working.

Scaling Center Item using Level Menu 2D

Create/Drag LevelMenu2D prefab into your scene. The property inspector of LevelMenu2D will look like the image on right:
  • Insert number of items in Size attribute of Items List.
  • Drag item game objects in the Items List array.
  • Set Orientation to Horizontal or Vertical.
  • Set Scale of Center Item to value greater than 1. This is the total percentage of the center item. For example, 1.0 means 100% size resulting in no change. 1.2 will result in the center item to be increased in size by 20%.

Putting Next/Back Buttons in the Menu

Create/Drag LevelMenu2D prefab into your scene. The property inspector of LevelMenu2D will look like the image on right:
  • Insert number of items in Size attribute of Items List.
  • Drag item game objects in the Items List array.
  • Set Orientation to Horizontal or Vertical.
  • Check Show Next Back Buttons to True.
  • Drag next and back button objects into game objects in the Next Button Object and Back Button Object.
  • You are set to go. These buttons will start working on click. Run the game, and enjoy.

Adjust Menu for Offset, Spacing, and other settings.

Create/Drag LevelMenu2D prefab into your scene. The property inspector of LevelMenu2D will look like the image on right:
  • Insert number of items in Size attribute of Items List.
  • Drag item game objects in the Items List array.
  • Set Orientation to Horizontal or Vertical.
  • Check Auto Update at Runtime to True.
  • Run the game, and your menu will be working.
Now, when you will update any settings in prefab inspector of LevelMenu2D, you will see those changes updated at runtime. Adjust your settings accordingly, and copy those settings. Stop the game, and paste those values in LevelMenu2D inspector settings. Note: It must be noted that Auto Updating affects the performance very badly and you should check it to false when building release version of your game.

Calling any method on Item Click using LevelMenu2D

Drag LevelMenu2D prefab into your scene. The property inspector of LevelMenu2D will look like the image on right:
  • Insert number of items in Size attribute of Items List.
  • Drag item game objects in the Items List array.
  • Set Orientation to Horizontal or Vertical.
  • Run the game, and your menu will be working.
  • Create any empty game object in the scene, and add a script in it (let's call it ClickerScript.cs).
  • To get Item Click, we will have to listen for OnItemClick delegate event.
Following code shows ClickerScript.cs:
 public class ClickerScript : MonoBehaviour {
    
    void Awake()
    {
	LevelMenu2D.I.OnItemClicked += OnItemClicked;
    }

    void OnItemClicked (int itemIndex, GameObject itemObject)
    {
	Debug.Log("Item Clicked: " + itemIndex + " Name: " + itemObject.name);
    }
 }

Manually navigation to next/previous or to any specific item in LevelMenu2D using Swipe Gestures

LevelMenu2D comes with built-in SwipeDetector. To get started, first drag LevelMenu2D prefab into your scene. The property inspector of LevelMenu2D will look like the image on right:
  • Insert number of items in Size attribute of Items List.
  • Drag item game objects in the Items List array.
  • Set Orientation to Horizontal or Vertical.
  • Run the game, and your menu will be working.
Now whenever or wherever you want to navigate to the menu, all you have to do is to access the singleton instance of LevelMenu2D and call methods from it. (It must be noted that there should be only instance of LevelMenu2D in one scene.) LevelMenu2D will automatically detect scene's menu and navigate it. The built-in Swipe Detector delegates events when any swipe is detected, and we have to listen for those delegate events in our code. Following code snippet shows finger gesture swiping navigation in file NavigatorScript.cs:
 public class NavigatorScript : MonoBehaviour {
    
    void Awake()
    {
	LevelMenu2D.I.OnItemClicked += HandleOnItemClicked;
        SwipeDetector.OnSwipeLeft += HandleOnSwipeLeft;
        SwipeDetector.OnSwipeRight += HandleOnSwipeRight;
    }

    void HandleOnItemClicked (int itemIndex, GameObject itemObject) {
        Debug.Log("Item Clicked: " + itemIndex + " Name: " + itemObject.name); 
    }

    void HandleOnSwipeRight ()
    {
        LevelMenu2D.I.gotoBackItem();
    }

    void HandleOnSwipeLeft ()
    {
        LevelMenu2D.I.gotoNextItem();
    }
}

Back to Contents

API Reference

There is only one class LevelMenu2D which manages all the interactions with LevelMenu2D.

LevelMenu2D

This class is the main interaction point with the LevelMenu2D API. This is a singleton class for Level Menus. You shouldn't instantiate this class using new keyword. Instead use LevelMenu2D.I to get an instance of LevelMenu2D. There should be only one instance of LevelMenu2D in any scene. The LevelMenu2D.I automatically reference to the only instance in the scene.

Properties & Fields

CurrentIndex

public int CurrentItem;
Returns the currently displayed index of LevelMenu2D. This is Read-Only property.

IsMoving

public bool isMoving;
Returns whether LevelMenu2D is currently in any transition of navigation or not. This is Read-Only property.

AutoUpdateAtRuntime

public bool autoUpdateAtRuntime = false;
Whether LevelMenu2D should be auto-updated at run-time or not. This is ONLY for testing and debugging purposes, and you should keep it to false when publishing your game for release. This can slow game's performance due to heavy operation.

Orientation

public MenuOrientation orientation = MenuOrientation.Custom;
The orientation of LevelMenu2D. It can be any from Horizontal, Vertical, or Custom. If you check auto-offset to false, and set own custom offset, then Custom orientation should be selected.

ItemsList

public List <GameObject> itemsList = new List<GameObject>();
The List of Items in the LevelMenu. This is list of GameObjects. You can put nested objects, 2D Sprites, or 3D objects without any problems. You shouldn't add items at runtime in this list. In case of adding items at run-time, you should recreate menu by calling recreateMenu() method.

InitialItemNumber

public int initialItemNumber = 0;
The Initial Item Index to be loaded at start of LevelMenu2D.

Scale Of Center Item

public float scaleOfCenterItem = 0;
The total percentage scale of center item. This should be greater than 1.0. 1.0 means 100% size resulting in no change in scale. 1.2 means the center item will be scaled by 20% in size.

FirstItem

public GameObject firstItem;
The First Item of the LevelMenu2D. This is set from items list automatically.

ShowNextBackButtons

public bool showNextBackButtons = false;
Whether Next/Back buttons to be shown in menu or not. False by default.

NextButtonObject

public GameObject nextButtonObject;
Next Button Game Object. Should be set if showNextBackButtons is set to true.

BackButtonObject

public GameObject backButtonObject;
Back Button Game Object. Should be set if showNextBackButtons is set to true.

AutoOffset

public bool autoOffset = true;
Whether to put items automatically based on Orientation. True by default. This would be true in case of Horizontal or Vertical Orientation.

ItemOffset

public Vector2 itemOffset = new Vector3(0f, 0f);
The itemOffset of the LevelMenu2D in case of autoOffset is false. If autoOffset is set to true, then this will be calculated from width (horizontal) or height (vertical) of the items. You can space those items from spacingBetweenItems field. The itemOffset's value will ignore all the above case, and put items based on this value. This is used to create custom orientation menus such as diagonal menus.

SpacingBetweenItems

public float spacingBetweenItems = 0f;
Space between items for Horizontal or Vertical Orientations. This won't be used if orientation is set to Custom and autoOffset is set to false.

EaseType

public iTween.EaseType easeType;
EaseType of the animation to navigate items. LevelMenu2D uses iTween primarily for animation purposes, so easy types can be selected from iTween.

AnimationTime

public float animationTime = 0f;
Animation Time for navigation between items.

IsBounded

public bool isBounded = false;
False means only one item is current at a time and true otherwise. This is used to create scroll bars instead of menus.

MinimumBoundIndex

public int minimumBoundIndex = 0;
Minimum Bound Index from the item list. You can't navigate to items whose index is less than minimum bound index. This is used only when isBounded is set to true.

MaximumBoundIndex

public int maximumBoundIndex = 0;
Maximum Bound Index from the item list. You can't navigate to items whose index is greater than maximum bound index. This is used only when isBounded is set to true.

Back to Contents

Methods

createMenu

public void createMenu()
Creates a new instance of the LevelMenu2D based on the settings initialized via inspector or using LevelMenu2D.I instance.

recreateMenu

public void recreateMenu()
Recreates an existing instance of the LevelMenu2D based on the settings initialized via inspector or using LevelMenu2D.I instance.

gotoItem

public void gotoItem(GameObject itemObject)
Navigates to the item object passed in parameter. This can be called through LevelMenu2D.I.gotoItem(). If itemObject doesn't exist in the items list, then it simply returns with no exceptions or runtime errors. Parameters: itemObject Item Object to be navigated to.

gotoItem

public void gotoItem(int itemIndex)
Navigates to the item index passed in parameter. This can be called through LevelMenu2D.I.gotoItem(). If itemIndex is less than zero or greater than number of items, then it simply returns with no exceptions thrown or runtime errors. Parameters: itemIndex Item Index to be navigated to.

indexOf

public void indexOf(GameObject itemObject)
Returns index of the GameObject of item passed in parameter if item is found in the list, otherwise it returns -1. Parameters: itemObject Item Object to be searched for the index.

gotoNextItem

public void gotoNextItem()
Navigates to Next Item.

gotoBackItem

public void gotoBackItem()
Navigates to Back/Previous Item.

sortOrderOfItems

public void sortOrderOfItems()
Sort order of items for z-index management.

dispatchCurrentItemClick

public void dispatchCurrentItemClick(int itemIndex, GameObject itemObject)
Dispatches Any Item's Click. This is used to auto-click on items. Parameters: itemIndex Item index to be clicked on. itemObject Item Object to be clicked on.

Back to Contents

Support

The fastest way to get support is to send me an email from Contact Me page . I try (and usually manage) to answer all incoming email within 24 hours. If you haven't got a response from us within 2 days please check your spam folder - I had several cases in the past where our super-fast response was eaten by some spam filter. For super-fast, super-accurate answers, please include the following details in your mail:
  • A short description of what you are trying to do.
  • A short description of what happened and how it differed from what you would have expected.
  • Any error messages you are seeing (if applicable), preferably a screenshot.
  • The version of Level Menu 2D you are using. You can find this on top of the CHANGES file that is located in the LevelMenu2D folder.
  • The version of Unity you are using. You can find this in the main menu Help > About Unity...
  • Whether you are using Unity Free or Unity Pro.
  • Please also include your invoice number. You can find it on the upper right corner of the invoice that Unity sent you after buying Level Menu 2D on the asset store. Note, that the PDF file name is not the invoice number. If you have a question before buying Level Menu 2D you can of course omit the invoice number.
Please also check our small FAQ page , maybe the answer to your question is already posted there. If you just came from there, hit the mail link above straight away.

Back to Contents

Frequently Asked Questions (FAQs)

Q: What is Level Menu 2D?

Level Menu 2D is a Unity Asset through which you can easily create Level Selection menus or galleries without any coding absolutely.

Q: Which versions of Unity3D are supported by Level Menu 2D?

Level Menu 2D is primarily developed for Unity4.3 2D. But it can be used in:
  • Unity 3.x
  • Unity 4.x
  • Unity 2D and 3D projects.
  • Unity Free and Pro versions
easily without any problems.

Q: Which third-party assets are required to use Level Menu 2D?

Level Menu 2D uses two third-party free assets, iTween and Singleton Perfect. These can be downloaded and imported from Asset Store from following links respectively:
  1. iTween: https://www.assetstore.unity3d.com/en/#!/content/84
  2. Singleton Perfect: https://www.assetstore.unity3d.com/en/#!/content/10071

Q: How many items can I put in the menu?

Unlimited items can be put in the Level Menu 2D. But, we highly recommend it to put not more than 100 items.

Q: What kind of Game Objects can be put as items in menu?

Yes, Level Menu 2D supports all game objects from Unity Sprites to Game Objects to Game Object with nested objects as well.

Q: What should be the size (width, height) or Scale of items?

There is no size restriction or policy for items except that all the items should have exactly same size.

Q: How can I know that any item is clicked in the menu?

When any item is clicked, a event is thrown. You can listen for that event, and you can write custom behavior for item clicks/touches there.

Q: Does LevelMenu2D support swipe gestures for navigation between items?

Yes. LevelMenu2D have built-in swipe gestures implemented for navigation. More further, you can use your own gesture library or any third party library for menu navigation of items.

Q: Why do I have to supply my invoice number for getting support?

We found several websites offering pirated copies of Level Menu 2D. Since we want to use our support resources to provide the best possible support for the customers who paid us their hard-earned money, we are not supporting pirated copies of Level Menu 2D. The invoice number allows us to verify that the copy of Level Menu 2D was actually purchased at the Unity asset store. If you have a question before buying Level Menu 2D you can of course ask it without providing an invoice number.

Back to Contents