原创 加載截圖之後的圖片輸出成圖片保存出去
using UnityEngine; using System.Collections; using System.IO; /// <summary> /// 加載截圖之後的圖片輸出成圖片保存出去 /// </summary> publi
原创 兩個Text 不重疊
創建一個父物體然後添加這個就好了
原创 鼠標滑動判斷移動方向
using System.Collections; using System.Collections.Generic; using UnityEngine; public class zuoyoiu : MonoBehaviour {
原创 Windows Service 開啓和禁用
//打包出去纔可以用必須以管理員方式運行 using System.Collections; using System.Collections.Generic; using System.Diagnostics; using UnityE
原创 刪除指定路徑下所有內容和把文件或文件夾重命名
public void DeleteAllFile(string fullPath) { //path爲路徑,可以右鍵文件選擇屬性看到 //判斷路徑或文件夾是否存在 if (Dir
原创 Unity自動創建Txt和讀取TXT 往Txt裏面可以寫入 兩種創建方法和四種讀取方式
using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO; //操作文件夾時需引用該命名空間 using
原创 Dotween動畫
Sequence quence = DOTween.Sequence(); quence.AppendInterval(0.1f);//等待0.1秒執行 quence.Append(transform
原创 實現截屏通過camera 截完賦值給RawImage上 三種方法
public Texture2D CaptureScreen(Camera came, Rect r) { RenderTexture rt = new RenderTexture((int)r.width, (
原创 獲取原生旋轉值 Inspector
public Vector3 GetInspectorRotationValueMethod(Transform transform) { // 獲取原生值 System.Type transfo
原创 控制物體旋轉和控制角度
//注意模型的軸向和U3d軸向是否一致 public float turnSpeed = 20; // Update is called once per frame void Update() {
原创 AssetBundle 使用Unload時 報錯問題
因爲instantiate沒有加載完 for循環裏面開始執行下一個instantiate 就會報錯 以下是解決辦法在for 循環裏面 for (int i = 0; i < xxx.Count; i++)
原创 unity2019使用unityWebRequest來代替WWW加載
首先使用命名空間:using UnityEngine.Networking; public void SetTexture(int _Index) { StopCoroutine("LoadTexture");
原创 人物框視差效果 UI跟鼠標移動
直接賦給Image即可 using UnityEngine; [RequireComponent(typeof(RectTransform))] public class zzzzzz : MonoBehaviour { pu
原创 錨點在Canvas的不同位置的情況:
Image節點的錨點在Canvas的不同位置的情況: left center right stretch top 左上角單錨點 Anchors.Min(0, 1) Anchors.Max(0, 1) 頂部邊框的中心單錨點
原创 調用系統軟件盤支持IL2CPP
using System; using System.Collections; using System.IO; using System.Runtime.InteropServices; using UnityEngine; using