
unity
TiMorGO
过去的悲伤带来的是未来的美好
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
unity 通过图片的黑色识别,生成对应的txt文本
unity 通过图片的黑色识别,生成对应的txt文本using System;using System.Collections;using System.Collections.Generic;using System.IO;using UnityEngine;using UnityEngine.UI;using Random = System.Random;public class Text1 : MonoBehaviour{ public Texture2D texture;原创 2021-05-27 09:34:10 · 257 阅读 · 0 评论 -
mac 连上手机断断续续断开的解决方案
mac 连上手机断断续续断开的解决方案sudo killall -STOP -c usbd原创 2021-02-25 10:32:44 · 2446 阅读 · 0 评论 -
unity 根据当前设备屏幕宽高截图最大正方形图片
unity 根据当前设备屏幕宽高截图最大正方形图片Texture2D screenShot;int width=(int)Screen.width;int height=(int)Screen.height;Rect rect= new Rect(0, 0, width, height);if(rect.height>rect.width){screenShot = new Texture2D((int)rect.width, (int)rect.width, TextureFormat.原创 2020-06-06 10:40:51 · 333 阅读 · 0 评论 -
unity解决手势点击物体没有效果
unity解决手势点击物体没有效果这是因为unity是默认点击ui的,如果需要点击物体,那么就需要在相机加上 Physics Raycaster 这样就可以点击物体啦原创 2020-06-06 10:25:33 · 704 阅读 · 0 评论 -
将屏幕空间上的点转换为位于给定RectTransform平面上的世界空间中的位置
这篇文章主要记录在开发中遇到的问题,当Canvas设置为“Screen Space - Overlay mode”模式的情况下,怎么让手势还能准确的拖动ui。/// /// 鼠标滑动中/// /// private RectTransform curRecTran;public void OnDrag(PointerEventData eventData){ Vector3 globalMousePos; if (RectTransformUtility.ScreenPoint原创 2020-06-02 20:59:33 · 205 阅读 · 0 评论 -
unity 文本框随字体大小,内容长短自动变化
unity text因为文字字体和长度造成无法显示完整,这个是让text根据文本内容自动变大// /// 字体区域灵活变大,只根据字体变高度,宽度是由用户拖动区域变化/// /// 需要改变的文本物体public void FontAreaChanges(Text text) { RectTransform rect = text.GetComponent<RectTransform>(); // 获取Text的Size Vector2 v2 = rect.re原创 2020-06-02 20:41:05 · 3022 阅读 · 0 评论 -
unity 判断设备是否平板、手机
安卓判断:float physicscreen = Mathf.Sqrt(Screen.width * Screen.width + Screen.height * Screen.height) / Screen.dpi;if (physicscreen >= 7f){Debug.Log(“安卓平板”);}else{Debug.Log(“安卓手机”);}ios判断:stri...原创 2019-12-18 18:02:01 · 1794 阅读 · 0 评论 -
unity全局提示和提示按钮事件控制
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;using System;public class TipsView : MonoBehaviour {private Text title;private Text content;pri...原创 2019-12-18 17:55:35 · 324 阅读 · 0 评论 -
Android平台的unity应用调起另外一个应用
bool fail = false;string bundleId = “com.xxx.xx”;AndroidJavaClass up = new AndroidJavaClass(“com.unity3d.player.UnityPlayer”);AndroidJavaObject ca = up.GetStatic(“currentActivity”);AndroidJavaObje...原创 2019-12-18 17:49:47 · 316 阅读 · 0 评论