Skip to main content

Posts

Showing posts from November, 2015

Slide Screens like Android or Ios with Unity UI

Hi guy's, finally i got little familiar with moving new unity UI, using scripts, so here i am sharing my experience.
My new project have this requirement to show an intro screen with 5 images to be slided one after another, as people say "necessity is the mother of invention" :) though i invented nothing :D but finally i am getting use to new UI.

In this video you can see, how i am sliding screens one by one.



Here is the script.

usingUnityEngine;
usingUnityEngine.UI;
usingSystem.Collections;

publicclassUIManager : MonoBehaviour {

publicRectTransformwelcomePanel;
publicRectTransform[] introImages;
publicSprite[] dotSprites;
publicImagedotImage;

publicfloatwide;

publicfloatmousePositionStartX;
publicfloatmousePositionEndX;
publicfloatdragAmount;
publicfloatscreenPosition;
publicfloatlastScreenPosition;
publicfloatlerpTimer;
publicfloatlerpPage;
publicboolisLerping = false;

publicintpageCount = 1;
publicintdotCount = 0;
stringside = "";


//Usethisforinitialization
voidStart () {
wide = we…