![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
unity开发
主攻U3D开发
BBoy_Lancos
不会PS的程序猿不是一个好BBoy
展开
-
根据日期锁定,配合前边的config配置代码一起使用
public class LockTest : MonoBehaviour{ //限定最小时间字符串 string minLockTime; //到期时间字符串 string maxLockTime; //最小时间整形 int minTime = 0; //到期时间整型 int maxTime = 0; //配置文件管理类 private ConfigTest configTest; //Main privat原创 2021-03-02 10:21:11 · 204 阅读 · 0 评论 -
unity串口通信
using System.Collections;using System.Collections.Generic;using UnityEngine;using System;using System.IO.Ports;public class PortManager : MonoBehaviour{ string getPortName; int baudRate = 9600; private Parity parity = Parity.None; private int da原创 2021-01-08 11:17:52 · 332 阅读 · 0 评论 -
TCP服务端
using System;using System.Collections;using System.Collections.Generic;using System.Net;using System.Net.Sockets;using System.Text;using System.Threading;using UnityEngine;public class SocketServer : MonoBehaviour{ int _port = 6000; strin原创 2020-12-29 11:03:09 · 201 阅读 · 0 评论 -
TCP客户端
using System;using System.Collections;using System.Collections.Generic;using System.Net;using System.Net.Sockets;using System.Text;using System.Threading;using UnityEngine;using UnityEngine.UI;public class TCPClient : MonoBehaviour{ int _por原创 2020-12-28 17:33:11 · 150 阅读 · 0 评论 -
UDP服务端
using System.Collections;using System.Collections.Generic;using UnityEngine;using System;using System.Net;using System.Net.Sockets;using UnityEngine.SceneManagement;using UnityEngine.UI;using System.Runtime.InteropServices;namespace ImmerUDP{原创 2020-12-28 17:29:23 · 241 阅读 · 0 评论 -
Config配置表
新建文件夹StreamingAssets在文件夹里新建一个名称为Config.txt的配置表Config配置表Config配置表代码具体调用可查看本作者网络文章代码using System.Collections;using System.Collections.Generic;using UnityEngine;using System.IO;using System;public class ConfigTest : MonoBehaviour{ private str原创 2020-12-28 17:28:26 · 1148 阅读 · 0 评论 -
UDP客户端
UDP客户端记得配合我Config配置表文章一块做using UnityEngine;using System.Collections;using System;using System.Net;using System.Net.Sockets;using System.Text;using System.Threading;public class UDP_Client : MonoBehaviour{ [Header("本地端口"), SerializeField]原创 2020-12-28 17:22:10 · 250 阅读 · 0 评论 -
Unity移动端Input触控和Window触摸屏电脑 控制相机旋转缩放
using UnityEngine;using System;using System.Collections;public class CameraController : MonoBehaviour{ /// <summary> /// 是否能旋转X轴 /// </summary> public bool canRotation_X = true; /// <summary> /// 是否能旋转Y轴 /原创 2020-12-14 15:41:45 · 2908 阅读 · 1 评论 -
Unity制作360度全景
创建一个sphere,scale的x,y,z分别设置为30创建一个SurfaceShader,右键Assets–>Create–>Shader–>InsideVisibleShader "Custom/InsideVisible" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {}} SubShader { Tags { "RenderType"="Opaque" } Cull front // ADDE原创 2020-12-09 15:19:50 · 1170 阅读 · 0 评论 -
unity字符串转换十六进制
private void btn_send_Click(string str) { try { string msg = str; byte[] buffer = new byte[1024 * 1024 * 3]; buffer = HexStringToByteArray(str); socketSend.Send(buffer); }原创 2020-12-09 10:06:07 · 1076 阅读 · 0 评论 -
Unity中获取Animator中动画片段的时长
private Animator animator;public void GetLengthByName(string name){ float length = 0; AnimationClip[] clips = animator.runtimeAnimatorController.animationClips; foreach(AnimationClip clip in clips) { if(clip.name.Equals(name)原创 2020-11-19 16:52:24 · 1042 阅读 · 0 评论 -
unity C#获得枚举(enum)类型的长度
C#enum Enum{ Type1, Type2,}class Program{ static void Main(string[] args) { var e = new MyEnum(); string[] EnumStr= System.Enum.GetNames(e.GetType()); }}unity void Start() { string[] EnumStr= Enum.原创 2020-11-17 10:08:23 · 1752 阅读 · 0 评论 -
unity在编辑模式下修改json文件
using Newtonsoft.Json.Linq;using System.Collections;using System.Collections.Generic;using System.IO;using UnityEditor;using UnityEngine;public class ChannelPackging : EditorWindow{[MenuItem(“渠道打包/渠道1-Default”, false, 100)]public static void Defau原创 2020-10-13 10:30:55 · 539 阅读 · 0 评论 -
unity退出游戏
#if UNITY_EDITORUnityEditor.EditorApplication.isPlaying = false;#elseApplication.Quit();#endif原创 2020-09-05 10:16:17 · 382 阅读 · 0 评论 -
Unity场景异步加载(进度条)
ABC三个场景,A是开始场景,B是进度条场景,C是目标场景A场景进入B场景的方法void Load() { Global.ScenesNum = 1;//BuildSettings加载的场景下标 SceneManager.LoadSceneAsync("LoadScene");//切换到进度条场景 }//Global.ScenesNum就是BuildSettings的下标这是B场景代码(进度条场景)using System.Collection原创 2020-07-11 11:17:37 · 337 阅读 · 0 评论 -
Unity UI Image渐隐渐现效果
创建UI Image,脚本直接拖上面using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class ImageAlpha : MonoBehaviour{ private Image image; float colorA; bool IsColorA; void Start() {原创 2020-07-07 11:03:44 · 1832 阅读 · 0 评论 -
Unity中的按键检测(可检测电视遥控器按键)
效果图脚本挂在任意物体上,创建一个UI text组件,拖拽到脚本上using System;using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class KeyCodeTest : MonoBehaviour{ public Text text; void Update() { if (Input.anyKeyDown)原创 2020-07-07 08:43:18 · 964 阅读 · 0 评论 -
unity显示FPS
**先创建UIText,然后把脚本挂在上面**private Text FpsText;private float time;private int frameCount;void Start(){ FpsText = GetComponent<Text>();}void Update(){ time += Time.unscaledDeltaTime;//unscaledDeltaTime完成最后一帧的时间 frameCount++;//帧数增加原创 2020-06-28 10:17:58 · 369 阅读 · 0 评论 -
unity画一条流动的弧线(贝塞尔线)
流动的线最终效果![弧线图](https://img-blog.csdnimg.cn/20190326111414679.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0JCb3lMWGlhbmc=,size_16,color_FFFFFF...原创 2019-03-26 11:38:40 · 4574 阅读 · 3 评论