- 博客(28)
- 收藏
- 关注
原创 应用Unity的Dots技术再一个锥形范围内不断生成子弹
应用Unity的Dots技术再一个锥形范围内不断生成子弹创建一个子弹结构体创建子弹移动系统生成一定数量的实体创建一个子弹结构体public struct BulletMove : IComponentData{public float MoveSpeed;public float ExistTime;}创建子弹移动系统创建一个子弹生成时间,遍历拥有这些结构体的组件,并操纵这些实体!private readonly float LifeTime = 5f;protected overri
2021-08-18 21:43:05
326
原创 预定义类型
Edit—> projectsetting—> Playerusing System.Collections;using System.Collections.Generic;using UnityEngine;public class Debuger//日志输出类{//预定义#if Debugstatic bool debug = true;#elsestatic bool debug = false;#endifpublic static void Log(stri.
2020-10-10 10:00:58
260
原创 大世界地图代码模板
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;public class BigWorldEditor : EditorWindow{[MenuItem(“BigWorldMenu/BigWorld”)]static void ShowWindow(){var window = GetWindow();window.titleContent = ne
2020-09-29 17:31:04
1538
原创 对象池粗解
using System.Collections;using System.Collections.Generic;using UnityEngine;public class Pool//对象池{public string prefabPath;//注意:把要动态加载的资源对象放在Resources文件夹下int maxCount = 10; //对象池的最大容量是10个List usingList = new List();//正在使用的列表List freeList = new
2020-09-17 14:51:57
100
原创 Unity异步加载资源以及手指触摸的实验
只贴代码主要是给自己看的## 标题using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class TestResources : MonoBehaviour{int index;[SerializeField] Texture[] Tex;public GameObject cube;//作为预制体必须动态加载GameObject c
2020-09-16 10:11:39
289
原创 AssetBundle 具体使用代码
//AssetBundleusing System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;//引入命名空间using System.IO;//引入文件读取相关的命名空间public class BundleTool : EditorWindow{string sourcePath;//需要打包的原始资源的路径string outPath;//资源打包成Assetbun
2020-09-14 11:01:48
185
原创 Unity 修改Inspector面板上的属性
using System.Collections;using System.Collections.Generic;using UnityEngine;public class TestCube : MonoBehaviour{public string monsterName = “”;public void PrintNmae(){Debug.Log(monsterName);//输出名字}}using System.Collections;using System.Collec
2020-09-10 14:10:59
1413
原创 在unity editor下创建一个窗口
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;using System.Xml.Serialization;using System.IO;public class EditorWindowTest : EditorWindow{string str = “”;[MenuItem(“Tools/EditorWindow”)]static void
2020-09-10 14:09:02
490
原创 序列化和反序列化 加上json数据流转换
using System.Collections;using System.Collections.Generic;using UnityEngine;public class TestPlayerPrefs{//单例模式实现private static TestPlayerPrefs _instance;public static TestPlayerPrefs Instance{get{if(_instance == null){_instance = new TestPlay
2020-09-09 11:07:04
271
原创 2020-09-08
using System.Collections;using System.Collections.Generic;using UnityEngine;public class TestCoroutine : MonoBehaviour{IEnumerator coroutine;private void Start(){ coroutine = Function1(); StartCoroutine(coroutine);}IEnumerator Function1()
2020-09-08 13:45:24
96
原创 Unity各种坐标转换方法
将屏幕坐标转换成视口坐标的方法Vector3 v = Camera.main.ScreenToViewportPoint(Input.mousePosition);Debug.Log(v); Vector3 v = Camera.main.WorldToScreenPoint(cube.transform.position);//世界坐标转屏幕坐标 Debug.Log(v + " sss" + cube.transform.position); Vec
2020-08-19 13:56:04
416
原创 虚函数 继承 + 方法重载 + 抽象类
using System.Collections;using System.Collections.Generic;using UnityEngine;public class ExtendsTest : MonoBehaviour{// Start is called before the first frame updatevoid Start(){//1.方法的重写//存在于子类和父类之间 有继承关系 2.父类的方法前面使用虚方法 子类用重写它 3.存在父类的引用指向子类
2020-08-03 15:21:29
157
原创 构造函数
using System.Collections;using System.Collections.Generic;using UnityEngine;namespace ztc{public class Classtest{public int a;public string name;private int b = 10;private float velocity = 5; public void Study() { ztc.Classtest p =
2020-07-30 16:41:56
99
原创 AutoResetEvent线程阻碍
using System.Threading;public class Foo {public Foo() { }static AutoResetEvent _Second = new AutoResetEvent(false);static AutoResetEvent _Third = new AutoResetEvent(false);public void First(Action printFirst) { // printFirst() outputs "f
2020-07-16 17:31:13
105
原创 Socket单次连接
using System;using System.Net;using System.Net.Sockets;using System.Text;namespace TCP客户端{class Program{static void Main(string[] args){Socket tcpClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);IPAddress ipad
2020-07-03 19:28:17
165
原创 反射
using System;using System.Collections.Generic;using System.Text;namespace 反射{class MyClass{private string Name { get; set; }private string ID { get; set; }public int number;public string Sex { get; set; } private void Test() { Con
2020-06-30 19:26:42
195
原创 记一点LinQ笔记 ,以后回来自己复习
使用LINQ做查询var res = from m in masterListwhere m.Level > 8select m.Name;foreach(var temp in res){Console.WriteLine(temp);}
2020-06-28 23:29:56
161
原创 Java初学者笔记 先记着 以后忘了回来看两眼
多态同一个对象 体现出来的多种不同形态(身份)将一种行为表现出不同的效果要想实现多态的效果 需要现有的继承关系体现:1:父类类型的引用 指向 子类的对象Person p = new Teacher();2.该引用只能调用父类中定义的属性或方法3.如果子类将父类中的方法重写,那么调取方法后执行的结果是子类重写之后的那个结果如果父类与子类有同名的属性 执行父类的属性如果父类与子类有同名的方法(重载) 执行子类重写之后的方法4.若想要调用子类中独有的成员(强制类型转化) 造
2020-06-28 20:50:09
1465
原创 c#字符串的一些方法的使用
//两个字符串相加的两个方法//--------------方法一 ---------------------------------------------//StringBuilder sb = new StringBuilder(“stringbuilder”,50);//sb.Append("/adder");//Console.WriteLine(sb.ToString());//Console.WriteLine(sb.Capacity);//--------------方法二 .
2020-06-25 19:51:45
148
原创 今天在Windows上做Unity3D开发,遇到几次了在UnIty里面提示这个There are inconsistent line endings in the Assets/Scripts/En
There are inconsistent line endings in the ‘Assets/Scripts/EnermyAI.cs’ script. Some are Mac OS X…解决办法:文件→高级保存选项把行尾改成Windows(CRLF)也不知道怎么回事 可能是今天更新了VS 之前的设置又不行了不过这个办法还是可以解决...
2020-06-13 17:29:26
2040
原创 关于Has exit time找不到的问题
找了半天找不到Has exit time,结果是没有点到状态机的线。记在这里希望以后都不会忘记这低级错误。。
2020-06-10 21:58:22
268
原创 关于制作Unity动画的时候出现的问题:
The legacy Animation Clip “XXX” cannot be used in the State “XXX”. Legacy AnimationClips are not allowed in Animator Controllers.To use this animation in this Animator Controller, you must reimport in as a Generic or Humanoid animation clip UnityEngine.GUI
2020-06-10 20:56:40
3983
原创 关于SceneManager.LoadScene的使用问题
关于SceneManager.LoadScene(); 的使用问题Scene with build index: couldn’t be loaded because it has not been added to the build settings.要使用这个方法必须要引进一个类 using UnityEngine.SceneManagement;然后再点击File→ build settings 把需要加载的场景拖进去如图所示,右边就是SceneManager.LoadScene()里面的参
2020-06-09 19:53:49
6656
原创 今天做个动画遇到的问题
关于给图片制作好动画,却只有调动画的时候显示了动画的问题原因是组件上只有一个Animation动画要播放需要两个组件Animator 和 Animation组件 两个组件都放在物体上才可以使这个物体播放动画
2020-06-09 19:19:39
181
原创 导入图片无法裁剪
从现在开始记录从Unity一路走来的点滴!第一个程序,想做个游戏开始界面,UI导入······。今天导入自己在PS做的图片,做了两张图放在一个大图里面导入Unity,结果在拆分他们的时候出现解决方法Windows→Package Manager 然后在右边搜索栏里面搜2D Sprite,点击右下角install装进去。问题就解决了!...
2020-06-08 22:58:41
357
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人