随笔分类 - Unity3D
摘要://Author:smilelance//From:http://blog.csdn.net/smilelance//转换C#代码:using System.Runtime.InteropServices;//结构体转换成字节流public static byte[] StructToBytes<T>(T obj) {int size = Marshal.SizeOf(typeof(T)); IntPtr bufferPtr = Marshal.AllocHGlobal(size);try { Marshal.StructureToPtr(obj, bufferPtr, false
阅读全文
摘要://Author:smilelance//From:http://blog.csdn.net/smilelance1、动画的循环animation.wrapMode = WrapMode.Loop; //设置所有动画的循环模式animation["death"].wrapMode = WrapMode.Once;//设置单个动画的循环模式2、动画层次animation["death"].layer = 1;layer默认是0,值越大显示优先级越高3、动画的切换animation.CrossFade("idle");animation.
阅读全文
摘要:Debug.Log("Version of the runtime: " + Application.unityVersion);注:这行代码必须写在主线程里,也就是继承自MonoBehaviour的脚本里
阅读全文
摘要:我们有一个继承自MonoBehaviour的类是用来做对象交互动作的,想做成单例的,写成通用的方法报错。private static Communication instance; public static Communication GetInstance() { if(instance==null){ instance=new Communication(); } return instance; }提示:You are trying to create a MonoBehaviour using the 'new' keyword. This is ...
阅读全文

浙公网安备 33010602011771号