摘要:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class MoveCube : MonoBehaviour { public Vector3[] pos; int num=0; // Use this for initialization ... 阅读全文
摘要:
效果图: 设置如下: 阅读全文
摘要:
我对 对象池的理解为: 在大型游戏中,往往有些物体需要不断的销毁,不断的生成,这样就很消耗资源。所以对象池技术就应运而生了。 比喻成一个池子,当不在需要时,本该销毁的物体,放回对象池中,使其失活,当再次需要使用时,再次从对象池中取出,让其激活。 当对象池中的物体全部取出,外界还需要时,在外界重新生成 阅读全文
摘要:
单例:通过此类,永远只能创建一个对象过程:1.创建一个类类型的静态变量2.编写private构造函数,给字段进行初始化3.编写静态方法,通过private构造函数创建类变量 (1)判断类变量是否为空 (2)如果为空,调用private构造函数创建类变量,不为空,直接return (3)函数返回类变量 阅读全文
摘要:
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _003进程 { class Program { stati... 阅读全文
摘要:
#define IsText//添加一个宏,接触注释 using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threadin... 阅读全文
摘要:
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace _001反射 { class Program { static... 阅读全文
摘要:
静态和非静态:区别:静态类与非静态类的重要区别在于静态类不能实例化,也就是说不能使用new关键字创建静态类类型的变量。在声明一个类时使用static关键字,具有两个方面的意义:首先,它防止程序员写代码来实例化该静态类;其次:它防止在类的内部声明任何实例字段或方法。 特点:1.静态类中只能包含静态成员 阅读全文
摘要:
数据的存入和读取: using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerfesText : MonoBehaviour { string usrname = "李四"; int password = 88888; // Use ... 阅读全文
摘要:
public void GetExit()//退出运行 { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false;//用于退出运行 #else Application.Quit(); #endif } GameObject go = new GameObject("Empty")... 阅读全文