Guide to Making hand Tour novice with Ugui

Source: Internet
Author: User

As a result of these days of work, the study of the next use of Ugui to make novice guidelines. There are many ways to achieve this effect, all using it again, and finally feeling this method is better. We need to create a canvas and then create a button under the canvas that needs to be referenced by a new finger.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5D/E3/wKioL1UmcYODx1AaAAAUPIcPe7Y270.jpg "style=" float: Left; "title=" QQ picture 20150409203000.png "alt=" Wkiol1umcyodx1aaaaaupicpe7y270.jpg "/>






Then add 2 components to the button that needs to be novice, one is Graphic raycaster and canvas, Graphic raycaster is used to accept can interact, canvas is changed display, remember we need a mask here, Just use an image to do it.

Then we add these 2 components to this 4 button, because here I am the test so I need a running game there is a button is highlighted state, so I use the code under control, and then we also need a novice guide inside the gesture instructions, this is instantiated.

Binding script UI Controller inside




650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5D/E3/wKioL1Umdc6DiNPIAACkvcRmWjE033.jpg "style=" float: Left; "title=" QQ picture 20150409204753.png "alt=" Wkiol1umdc6dinpiaackvcrmwje033.jpg "/>











Here is the test code:

Using Unityengine;

Using Unityengine.ui;

Using System.Collections;

Using System.Collections.Generic;


public class Newbieguidetest:monobehaviour

{

public bool Isguider = FALSE;

public Image instructions;

Public list<button> guidebtn;

void Start ()

{

Image go = gameobject.instantiate (instructions) as Image;

Go.transform.SetParent (Guidebtn[0].transform);

Go.transform.localPosition = Vector3.zero;

Go.transform.localScale = Vector3.one;

Guidebtn[0]. Getcomponent<canvas> (). Overridesorting = true;

Guidebtn[0]. Getcomponent<canvas> (). Sortingorder = 4;

}


public void beginguide (int value)

{

Switch (value)

{

Case 0:

Destroy (Gameobject.find ("Instructionsimage (Clone)");

CHANGGUIDEBTN (value);

Generateinstructions (value);

Break

Case 1:

Destroy (Gameobject.find ("Instructionsimage (Clone)");

CHANGGUIDEBTN (value);

Generateinstructions (value);

Break

Case 2:

Destroy (Gameobject.find ("Instructionsimage (Clone)");

CHANGGUIDEBTN (value);

Generateinstructions (value);


Break

Case 3:


Break

}

}


public void generateinstructions (int value)

{

Image go = gameobject.instantiate (instructions) as Image;

Go.transform.SetParent (Guidebtn[value+1].transform);

Go.transform.localPosition = Vector3.zero;

Go.transform.localScale = Vector3.one;

}



public void changguidebtn (int value)

{


Guidebtn[value]. Getcomponent<canvas> (). Overridesorting = false;

Guidebtn[value]. Getcomponent<canvas> (). Sortingorder =-1;

Guidebtn[value + 1]. Getcomponent<canvas> (). Overridesorting = true;

Guidebtn[value + 1]. Getcomponent<canvas> (). Sortingorder = 2;

}



}

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5D/E7/wKiom1Umc-uh-kpsAACdm8awve0709.jpg "style=" float: Left; "title=" QQ picture 20150409204542.png "alt=" Wkiom1umc-uh-kpsaacdm8awve0709.jpg "/>
























There are other ways to change the depth, by Setsiblingindex There is also a component that can be used by the canvas Group, so that you can see the API, the usage of these components.






This article is from "Cool Little Joe" blog, please be sure to keep this source http://5152481.blog.51cto.com/5142481/1630689

Guide to Making hand Tour novice with Ugui

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.