扩展偏好设置面板——PreferenceItem

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

示例 using UnityEngine; using UnityEditor; using System.Collections; /// <summary> /// 扩展偏好设置面板 /// </summary> public class CPreferenceItem { private static bool pre...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4121)

监听资源编辑——AssetModificationProcessor

作者:追风剑情 发布于:2017-11-8 17:39 分类:Unity3d

示例 using UnityEngine; using UnityEditor; using System.Collections; /// <summary> /// 参考 http://www.xuanyusong.com/archives/3535 /// 监听资源修改、删除、移动 /// </summary> public clas...

阅读全文>>

标签: Unity3d

评论(0) 浏览(6806)

监听资源导入——AssetPostprocessor

作者:追风剑情 发布于:2017-11-7 15:57 分类:Unity3d

重写AssetPostprocessor可对资源的导入、移动、删除等进行后处理 using UnityEngine; using UnityEditor; using System.Collections; /// <summary> /// 参考 http://blog.csdn.net/yhy2218/article/details/50847127...

阅读全文>>

标签: Unity3d

评论(0) 浏览(8875)

光源Cookie

作者:追风剑情 发布于:2017-10-30 11:54 分类:Unity3d

一、准备一张512x512的Cookie纹理 场景预览

阅读全文>>

标签: Unity3d

评论(0) 浏览(2706)

Transform接口说明

作者:追风剑情 发布于:2017-10-27 16:22 分类:Unity3d

//模型正前方的世界坐标 public Vector3 forward { get; set; } //本地坐标转世界坐标 public Vector3 TransformDirection(Vector3 direction); public Vector3 TransformDirection(float x, float y, float z); public Vector3 Tr...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3584)

预制类型——UnityEditor.PrefabType

作者:追风剑情 发布于:2017-9-27 14:16 分类:Unity3d

先写个脚本用来打印选中的对象所属类型 using UnityEngine; using UnityEditor; public class TestEditor : MonoBehaviour { [MenuItem("Assets/ShowSelectionType", false, 0)] private static void ShowSe...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4339)

TweenPingPong

作者:追风剑情 发布于:2017-8-24 19:43 分类:Unity3d

/// <summary> /// 往复运动 /// </summary> public class TweenPingPong : MonoBehaviour { public Vector3 from = Vector3.zero; public Vector3 to = Vector3.zero; public float str...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3780)

使用预定义GUI样式(GUI.skin.customStyles)

作者:追风剑情 发布于:2017-8-24 17:15 分类:Unity3d

Unity预定义的样式全在这GUI.skin.customStyles[]里,Unity4.7中有486种。 代码示例 using UnityEngine; using UnityEditor; using System.Text; using System.Collections; [CustomEditor(typeof(Test))] [CanE...

阅读全文>>

标签: Unity3d

评论(0) 浏览(10166)

基于层的碰撞检测(Layer Collision Matrix)

作者:追风剑情 发布于:2017-8-17 10:05 分类:Unity3d

Edit->Project Settings->Physics 层碰撞矩阵用来设置某层可以与哪些层进行碰撞

阅读全文>>

标签: Unity3d

评论(0) 浏览(15832)

Camera的Target Texture

作者:追风剑情 发布于:2017-8-3 17:14 分类:Unity3d

如果Camera的Target Texture设置了一张Render Texture,那么Camera的渲染画面将输出到这张Render Texture上。 下面是使用两个场景Camera,其中一个Camera设置了一张Render Texture,并把这张Render Texture放到场景中,从而制作出场景缩略图效果。

阅读全文>>

标签: Unity3d

评论(0) 浏览(5128)

加载场景AssetBundle

作者:追风剑情 发布于:2017-8-2 16:42 分类:Unity3d

示例:Unity4.x using UnityEngine; using System.Collections; public class SceneManager : MonoBehaviour { public void LoadSceneAsyn(string sceneName) { StartCoroutine(LoadScene(...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4256)

自发光(Emission)

作者:追风剑情 发布于:2017-7-31 20:19 分类:Unity3d

Unity5中的自发光在烘焙时可作为光源。 一、新建场景,如图: Plane、Cube、Sphere的Static需勾选上Lightmap Static 二、设置Sphere的自发光为红色 三、对场景进行烘焙 再看看Cube背面 自发光不能穿透Cube ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(11571)

Mathf.DeltaAngle()

作者:追风剑情 发布于:2017-7-27 16:02 分类:Unity3d

计算当前角度转到目标角度的最小旋转角度 using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Example() { Debug.Log(Mathf.DeltaAngle(1080, 90)); Deb...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4092)

Mathf.ClosestPowerOfTwo()

作者:追风剑情 发布于:2017-7-27 14:32 分类:Unity3d

返回最接近的2的指数次方的值 示例一 using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Example() { Debug.Log(Mathf.ClosestPowerOfTwo(7)); ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3234)

动态障碍物——NavMeshObstacle

作者:追风剑情 发布于:2017-7-26 23:12 分类:Unity3d

一、创建一个简单场景,如图 说明:Capsule代表玩家,Cube是一个动态障碍物,地面是一个Plane 下面说明下这个场景的制作过程: 1、选中Plane,并打开Window->Navigation 2、创建一个Cube作为动态障碍物,并在Cube挂个NavMeshObstacle组件。 ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(5234)

RectTransform

作者:追风剑情 发布于:2017-7-26 14:10 分类:Unity3d

示例 (Unity5.5.2f1) PosX PosY PosZ 相对锚点的位置, PosZ会影响UI层级,越大越靠前(靠近摄像机) Pivot 控件本地坐标系原点位置,左下角(0,0),右上角(1,1) Anchors 锚点位置(相对父容器的百分比) Rotation 旋转 Scale 缩放 ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3523)

Resources

作者:追风剑情 发布于:2017-7-25 23:55 分类:Unity3d

一、新建Resources目录。 二、把要利用Resources类加载的资源放到此目录下。 示例一:同步加载UI using System.Collections; using System.Collections.Generic; using UnityEngine; /// <summary> /// 同步加载UI /// </summary> p...

阅读全文>>

标签: Unity3d

评论(0) 浏览(2879)

Debug.Log()

作者:追风剑情 发布于:2017-7-25 20:47 分类:Unity3d

富文本标签 using System.Collections; using System.Collections.Generic; using UnityEngine; public class DebugTest : MonoBehaviour { void Start () { //b: 加粗, i:倾斜, size:大小, color:颜...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3378)

SkyBox(天空盒)

作者:追风剑情 发布于:2017-7-22 14:51 分类:Unity3d

一、下载天空盒资源 二、创建材质,并设置天空贴图 三、打开Window->Lighting窗口 四、Scene预览

阅读全文>>

标签: Unity3d

评论(0) 浏览(4403)

布娃娃系统

作者:追风剑情 发布于:2017-7-15 23:23 分类:Unity3d

示例所用版本:Unity2017 一、在Assets Store下载场景和模型资源 二、制作一个简单场景,并把人物模型(Max)拖到场景中 必须要是带骨骼的人物模型才能制作布娃娃。 打开布娃娃设置面板(GameObject->3D Object-> Ragdoll...),...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4005)

烘焙光照贴图

作者:追风剑情 发布于:2017-7-14 23:24 分类:Unity3d

示例所使用的版本:Unity2017 一、导入一个模型RollerBall.fbx,并设置属性 二、把要烘焙的模型的static设置成Lightmap Static 三、把要烘焙的灯光的Model属性设置成Baked 四、打开[Window]->Lighting->Setti...

阅读全文>>

标签: Unity3d

评论(0) 浏览(2724)

ScrollView

作者:追风剑情 发布于:2017-7-14 19:35 分类:Unity3d

利用UGUI的ScrollView组件制作滚动区域 使用版本:Unity2017 运行测试 以上步骤基本都采用的默认设置,只调整了下坐标和尺寸。 对ScrollView的主要参数进行下说明: Movement T...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4006)

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号