合并网格(Mesh)

作者:追风剑情 发布于:2016-11-24 12:07 分类:Unity3d

一、创建1个Cube和Sphere 二、创建1个空GameObject取命为Combine,并挂上相应组件。 三、运行效果   代码 using UnityEngine; using System.Collections; using System.Collections.Generic; public class ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3892)

[RequireComponent(typeof(xxx))]

作者:追风剑情 发布于:2016-11-12 10:55 分类:Unity3d

1、创建三个脚本Test1、Test2、Test3 2、当我们把Test1拖到GameObject上时,Test2、Test3会自动被挂到这个GameObject上。 using UnityEngine; [RequireComponent(typeof(Test2))] [RequireComponent(typeof(Test3))] public class Test1 :...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4415)

Transform.TransformPoint()

作者:追风剑情 发布于:2016-11-9 20:53 分类:Unity3d

using UnityEngine; using System.Collections; public class Test : MonoBehaviour { public GameObject someObject; public void Awake() { //在当前对象(transform)的右边实例化一个物体(someObje...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4919)

[AddComponentMenu("")]

作者:追风剑情 发布于:2016-11-3 15:07 分类:Unity3d

把脚本加入Component菜单 using UnityEngine; [AddComponentMenu("NGUI/MyComponent")] public class MyComponent : MonoBehaviour { }   效果    

阅读全文>>

标签: Unity3d

评论(0) 浏览(5246)

EditorUtility.DisplayDialogComplex()

作者:追风剑情 发布于:2016-10-31 16:00 分类:Unity3d

显示复杂对话框 using UnityEngine; using UnityEditor; /// <summary> /// 编辑器工具 /// </summary> public class EditorUtilityTest { [MenuItem("Test/DisplayDialogComplex")] public sta...

阅读全文>>

标签: Unity3d

评论(0) 浏览(5030)

EditorUtility.DisplayDialog()

作者:追风剑情 发布于:2016-10-31 15:50 分类:Unity3d

显示一个模态对话框 using UnityEngine; using UnityEditor; using System.Collections; /// <summary> /// 编辑器工具 /// </summary> public class EditorUtilityTest { [MenuItem("Test/DisplayDia...

阅读全文>>

标签: Unity3d

评论(0) 浏览(6561)

捕获日志——Application.RegisterLogCallback()

作者:追风剑情 发布于:2016-8-11 11:25 分类:Unity3d

using UnityEngine; using System; using System.Collections; public class UITest : MonoBehaviour { string log; string stack; string type; void Start () { //引发一个异常 ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(6334)

屏幕特效——灰度处理

作者:追风剑情 发布于:2016-7-16 14:06 分类:Shader

示例:屏幕后期处理——灰度处理 GrayImageShader.Shader Shader "Custom/GrayImageShader" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _LuminosityAmount ("GrayScale Amount", Range(0.0, 1)) ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3868)

protobuf-net

作者:追风剑情 发布于:2016-5-10 17:37 分类:Unity3d

C#对象的序列化与反序列化 从网上下载protobuf-net.dll并放入Assets\Plugins目录下。 示例一 Test.cs using UnityEngine; using System; using System.IO; using System.Collections; using ProtoBuf; publ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4323)

摄像机跟随主角

作者:追风剑情 发布于:2016-4-22 15:23 分类:Unity3d

一、创建脚本 using UnityEngine; using System.Collections; /// <summary> /// 把此类挂到要跟随物体的相机上 /// </summary> public class FollowPlayer : MonoBehaviour { //跟随目标对象 public Transf...

阅读全文>>

标签: Unity3d

评论(0) 浏览(16352)

播放动画(Animation)

作者:追风剑情 发布于:2016-4-20 16:00 分类:Unity3d

Legacy Unity 5 之后的版本,如果要使用 Animation 组件播放动画,需要将动画文件(*.anim)设置为 Legacy 模式。 如果是模型文件(*.fbx),则需要将 Animation Type 设置为 Legacy。 倒播 将speed设置为负数,再调用Play(),可实现倒播。例如: animation...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4083)

Unity工程中的特殊文件夹

作者:追风剑情 发布于:2016-4-11 20:22 分类:Unity3d

特殊文件夹 名称 描述 Assets 工程资源主目录 Editor 放编辑器功能扩展脚本 ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(2852)

3D Text

作者:追风剑情 发布于:2016-3-29 10:14 分类:Unity3d

    解决3D Text总显示在最上面问题 转载 https://blog.csdn.net/sarsscofy/article/details/85090002 一、导入字体文件 Font Size改大点字迹会更清晰。 二、创建3DTextShader和...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3512)

柏林噪声——Mathf.PerlinNoise()

作者:追风剑情 发布于:2016-3-24 14:16 分类:Unity3d

柏林噪声用来模拟火焰、云彩、生成地形高度图、奇形怪状的岩石、树木和大理石表面等。 using UnityEngine; using System.Collections; public class PerlinNoiseTest : MonoBehaviour { public int pixWidth; public int pixHeight; ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(7407)

Debug.DrawLine()

作者:追风剑情 发布于:2016-3-3 15:26 分类:Unity3d

一、创建脚本 using UnityEngine; using System.Collections; public class DebugTest : MonoBehaviour { public Transform cube0; public Transform cube1; void Update() { Deb...

阅读全文>>

标签: Unity3d

评论(0) 浏览(6045)

行为树

作者:追风剑情 发布于:2016-2-17 15:46 分类:Unity3d

=====================行为树(Behavior Tree)框架代码====================== 父节点: using UnityEngine; using System.Collections.Generic; /// <summary> /// 父节点 /// </summary> publ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4565)

系统语言检测——SystemLanguage

作者:追风剑情 发布于:2016-1-29 14:19 分类:Unity3d

using UnityEngine; using System.Collections; public class SystemLanguageTest : MonoBehaviour { void OnGUI() { GUI.color = Color.green; //系统语言检测 GUI.Label(new...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3029)

判断网络状态——NetworkReachability

作者:追风剑情 发布于:2016-1-29 14:10 分类:Unity3d

using UnityEngine; using System.Collections; public class InternetTest : MonoBehaviour { void OnGUI() { GUI.color = Color.green; GUI.Label(new Rect(20, 20, 500, 200),...

阅读全文>>

标签: Unity3d

评论(0) 浏览(7708)

输入管理器——Input Manager

作者:追风剑情 发布于:2016-1-28 15:50 分类:Unity3d

位于菜单 Edit->Project Settings->Input 字段解释参见: http://www.ceeger.com/Components/class-InputManager.html 对应脚本类Input http://www.ceeger.com/Script/Input/Input.html

阅读全文>>

标签: Unity3d

评论(0) 浏览(3961)

屏幕拾取

作者:追风剑情 发布于:2016-1-27 14:42 分类:Unity3d

示例一: 判断鼠标选中的物体 using UnityEngine; using System.Collections; public class ScreenPointToRayTest : MonoBehaviour { void Update() { if (Input.GetMouseButtonDown(0)) { ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(2969)

动画事件——AnimationEvent

作者:追风剑情 发布于:2016-1-27 11:17 分类:Unity3d

一、创建一个Cube并选中,   二、创建个脚本并挂在Cube上 using UnityEngine; using System.Collections; public class AnimationEventTest : MonoBehaviour { void Event0 () { print("Event0")...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3957)

协程——Coroutine

作者:追风剑情 发布于:2016-1-26 14:31 分类:Unity3d

using UnityEngine; using System.Collections; public class YieldTest : MonoBehaviour { public void Awake() { print("Begin Awake"); //StartCoroutine("FunCoroutine1"); ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4798)

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号