Tag:unity

  • Unity UI drag and drop model selection function

    Time:2021-4-29

    Specify an area, and drag the area with the mouse or finger of the player. The model will be offset and used to select characters and props Define some properties for the model using System.Collections; using System.Collections.Generic; using UnityEngine; public class UIModelUtil : MonoBehaviour { public Animator animator; public int id; public int index; } […]

  • Unity realizes UI halo effect (luminous effect)

    Time:2021-4-8

    In unity, how do we make the fading effect of UI objects? For example, we have a picture of an elf with a halo of the moon We can add a canvas group component to it We can find that the alpha value on the component can control the transparency of the image, from 0 […]

  • Unity shader for stroke outline effect

    Time:2021-4-7

    In this paper, we share the specific code of unity shader to achieve stroke outline effect for your reference. The specific content is as follows The process of shading is roughly as follows: draw the model twice (two passes), enlarge the model along the normal direction of vertex in vertex shader in the first pass […]

  • Unity to achieve novice guide hollow effect

    Time:2021-3-7

    This example for you to share the unity novice guide hollow effect of the specific code, for your reference, the specific content is as follows 1、 Realization idea Create a mesh with 8 vertices, and the inner and outer boundaries are quadrangles (rectangles). Only the mesh between the inner and outer edges is generated, and […]

  • Unity shader for novice guide mask

    Time:2021-3-5

    In the past two days, we have realized the mask and hollowed out shader effect that novices need to guide. Let’s record it. 1. Round hollow shader code:    //The distance between the world coordinates of the element and the center position of the target is calculated float dis = distance(IN.worldPosition.xy, _Center.xy); //The elements whose distance […]

  • Unity realizes virtual rocker

    Time:2021-1-5

    This example for you to share the unity of virtual rocker specific code, for your reference, the specific content is as follows Set some properties on the panel, such as the drag distance of the rocker, whether it is always visible, and whether it limits the position of the virtual rocker (I limit the virtual […]

  • Unity realizes virtual rocker effect

    Time:2021-1-1

    This example for you to share the unity virtual rocker effect of the specific code, for your reference, the specific content is as follows First add both images From left to right are back and front Put the front in the center of the backAdd script to front using System.Collections; using System.Collections.Generic; using UnityEngine; using […]

  • Unity realizes simple virtual rocker

    Time:2020-12-29

    Recently, we have been using ugui to make virtual rocker. The common practice on the Internet is to use the following code, but there are some precautions,The first point is that canvas’s render mode must be screen space overlay. The second point is that X and y of the anchor where the script is mounted […]

  • Virtual joystick control by unity

    Time:2020-12-22

    In this paper, we share the specific code of unity to realize virtual rocker control for your reference. The specific content is as follows using UnityEngine; using UnityEngine.UI; public class TouchJoystick : MonoBehaviour { Public GameObject go; // the target object that needs to be controlled through the virtual rocker Public float movespeed = 3; […]

  • Realization method of unity virtual rocker

    Time:2020-12-21

    In this paper, we share the specific code of unity virtual rocker for your reference. The specific content is as follows Set the anchor points for the background image of the rocker as follows: Set the anchor of the rocker as the center of the background image. And bind the rocker with the following script: […]

  • Unity uses scrollrect to make a rocker

    Time:2020-12-19

    In this paper, we share the specific code of unity using scrollrect to make rocker for your reference. The specific content is as follows 1、 Preface In game development, rocker function is very common, unity ugui providesScrollRectComponent, which is very suitable for making rocker. The effect is as follows: 2、 Implementation 1. Making UI As […]