07 2012 档案
摘要:原文地址http://www.unifycommunity.com/wiki/index.php?title=General_Performance_TipsScriptingAre you using the right algorithm? Selecting the rightalgorithm for a task yields much better optimization than any othercode tweaking you might do. Note that the best algorithm is notalways the one with the low.
阅读全文
摘要:Unity内部的脚本,是通过附加自定义脚本对象到游戏物体组成的。在脚本对象内部不同的函数被特定的事件调用。最常用的列在下面:Awake: 在MonoBehavior创建后就立刻调用Start: 将在MonoBehavior创建后在该帧Update之前,在该Monobehavior.enabled == true的情况下执行。当MonoBehavior没有定义[ExecuteInEditMode]时 总结:我们尽量将其他Object的reference设置等事情放在Awake处理。然后将这些reference的Object的赋值设置放在Start()中来完成。当MonoBehavior有定义[.
阅读全文
摘要:之前做工具时需要获取Gameobject下所有子物件,删除除了某个子物件之外其他子物件上的除了tranform的组件关于代码片段View Code 1 //获取所有子物体 2 foreach (Transform t in go.transform) 3 { 4 if (!t.name.Equals("Quality")) 5 { 6 UnityEngine.Object....
阅读全文
摘要:如题需求using UnityEngine;using System.Collections;using UnityEditor;using System.Collections.Generic;public class DestroySubComponent{ [MenuItem("Assets/Example/DestroySubComponent")] public static void DestroySubCom() { UnityEngine.Object[] selection = Selection.GetFiltered(typeof(UnityEngin
阅读全文
摘要:unity3d 提供了比读取txt,xml更好用的ScriptableObject(脚本对象化)。为了方便于版本管理,一般会添加一个版本号(guid) 1 public class ScriptObjectCOS : ScriptableObject 2 { 3 public string guid = ""; 4 } 5 6 public class LevelPortalRefTable : ScriptObjectCOS 7 { 8 public List<LevelPortalRef> levelPortalRefList = new List<L
阅读全文
摘要:using UnityEngine;using System.Collections;public class StoneDrop : MonoBehaviour { public floatfireTime; //开火时间 public floatcoolTime; //冷却时间 void Start() {coolTime = 2.0f; } // Update iscalled once per frame void Update() {if(fireTime < coolTime){fireTime += Time.deltaTime;}if(fireTime > cool
阅读全文
摘要:三层结构http://www.cnblogs.com/gaoweipeng/archive/2009/01/18/1377855.html设计模式http://www.cnblogs.com/zhenyulu/category/6930.html
阅读全文
浙公网安备 33010602011771号