当前位置:网站首页>Unity tips - draw aiming Center
Unity tips - draw aiming Center
2022-07-06 17:41:00 【sesame seeds】
- Click the jump =>《 Navigation post 》- Unity manual , Systematic practical learning
- Click the jump =>《 Navigation post 》- Android manual , Revisit mobile development
This article is about 2 Thousand characters , Novice reading needs 4 minute , Review needs 1 minute 【 Collect at any time, no longer get lost 】
About author
as everyone knows , Life is a long process , constantly overcome difficulties , Constantly reflect on the process of progress . In this process, there will be a lot of questions and thoughts about life , So I decided to put my thinking , Share all your experiences and stories , To find resonance !!!
Focus on Android/Unity And various game development skills , as well as Share various resources ( Website 、 Tools 、 material 、 Source code 、 Games etc. )
If you need anything, welcome me , Communication groups make learning No longer alone .

Practice process
Preview effect

In fact, it's very simple to implement , It only needs Rect Classes and DrawTexture The method can .
Let's see. Rect Parameter description inside ,
Rect(float x, float y, float width, float height)
Parameter one : At the top left corner of the rectangle x spot
Parameter two : At the top left corner of the rectangle y spot
Parameter 3 : At the top right corner of the rectangle x spot
Parameter 4 : At the top right corner of the rectangle y spot
This is a rectangle
We're looking DrawTexture Method , Pass two parameters , Parameter 1 is rectangle , The second parameter is the texture painted by the target .
public class Test : MonoBehaviour
{
public Texture texture;
void OnGUI()
{
// >>1 and /2 It's the same
// Draw centroid - This is the matrix size set according to the size of the texture
// Rect rect = new Rect(Input.mousePosition.x - (texture.width >> 1),
// Screen.height - Input.mousePosition.y - (texture.height >> 1), texture.width, texture.height);
// GUI.DrawTexture(rect, texture);
// This is the specified matrix size , No matter how big the texture , Will zoom in
int widthAndHeight = 10;
Rect rect = new Rect(Input.mousePosition.x - widthAndHeight / 2, Screen.height - Input.mousePosition.y - widthAndHeight / 2, widthAndHeight, widthAndHeight);
GUI.DrawTexture(rect, texture);
}
}
other
author : Xiaokong and Xiaozhi Xiaokong
Reprint note - Be sure to indicate the source :https://zhima.blog.csdn.net/
This Taoist friend, please Step back ️, I watch you Extraordinary bearing , There is a king's domineering spirit in his speech , There will be a great achievement in the future !!! There is give the thumbs-up Collection Today I tell you , Have you ordered it , Your success in the future ️, I don't take a penny , If it doesn't work ️, Or come back to me .
reminder : Click the card below to get more unexpected resources .
边栏推荐
- TCP连接不止用TCP协议沟通
- [mmdetection] solves the installation problem
- Remote code execution penetration test - B module test
- Redis quick start
- Wordcloud colormap color set and custom colors
- 基于Infragistics.Document.Excel导出表格的类
- Guidelines for preparing for the 2022 soft exam information security engineer exam
- The art of Engineering (3): do not rely on each other between functions of code robustness
- The solution that flutterweb browser cannot be rolled back after refreshing
- [reverse intermediate] eager to try
猜你喜欢

全网最全tcpdump和Wireshark抓包实践

学 SQL 必须了解的 10 个高级概念

Vscode matches and replaces the brackets

Automatic operation and maintenance sharp weapon ansible Foundation

EasyCVR授权到期页面无法登录,该如何解决?

PySpark算子处理空间数据全解析(5): 如何在PySpark里面使用空间运算接口

Re signal writeup

Unity小技巧 - 绘制瞄准准心

【ASM】字节码操作 ClassWriter 类介绍与使用
![[reverse primary] Unique](/img/80/9fcef27863facc9066e48f221c6686.png)
[reverse primary] Unique
随机推荐
TCP连接不止用TCP协议沟通
EasyCVR电子地图中设备播放器loading样式的居中对齐优化
虚拟机启动提示Probing EDD (edd=off to disable)错误
Kali2021 installation and basic configuration
关于Selenium启动Chrome浏览器闪退问题
【MySQL入门】第四话 · 和kiko一起探索MySQL中的运算符
mysql高级(索引,视图,存储过程,函数,修改密码)
PySpark算子处理空间数据全解析(4): 先说说空间运算
04个人研发的产品及推广-数据推送工具
[ASM] introduction and use of bytecode operation classwriter class
mysql高級(索引,視圖,存儲過程,函數,修改密碼)
沉淀下来的数据库操作类-C#版(SQL Server)
How uipath determines that an object is null
[elastic] elastic lacks xpack and cannot create template unknown setting index lifecycle. name index. lifecycle. rollover_ alias
Models used in data warehouse modeling and layered introduction
Unity小技巧 - 绘制瞄准准心
MySQL Advanced (index, view, stored procedures, functions, Change password)
Total / statistics function of MySQL
Concept and basic knowledge of network layering
06 products and promotion developed by individuals - code statistical tools