In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces unity how to achieve the effect of writing on the screen, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
The details are as follows
First create a RawImage, then add a LineRenderer component to the picture, then create a shader, change the Shader of the shader to Particles/Additive, drag the shader to Materials/Element 0 of the LineRenderer component, and finally drag the code to the empty object. The Target of the code is RawImage, and the following code
Using System.Collections;using System.Collections.Generic;using UnityEngine;public class huaxian: MonoBehaviour {private GameObject clone;private LineRenderer line;int ibank / with LineRender object public GameObject target;void Start () {Debug.Log ("Please start writing");} / / Update is called once per frame void Update () {if (Input.GetMouseButtonDown (0)) {/ / instantiate object clone = (GameObject) Instantiate (target, target.transform.position, Quaternion.identity) / / get the LineRender components on the object line = clone.GetComponent (); / / set the start and end colors line.SetColors (Color.red, Color.blue); / / set the width of the start and end line.SetWidth (0.2f, 0.1f); / / count I = 0;} if (Input.GetMouseButton (0)) {/ / detect each frame, the longer you press the mouse, the more iComplete + / / set the number of vertices line.SetVertexCount (I); / / set the vertex position (index of vertices, convert the screen coordinates of mouse clicks into world coordinates) line.SetPosition (I-1, Camera.main.ScreenToWorldPoint (new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 15));}
Thank you for reading this article carefully. I hope the article "how to achieve the effect of unity writing on screen" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.