随笔分类 -  -=Unity3d=-

1
摘要:注意:sendmessage只可以从网页发信息到unity游戏里,但是没有返回值只可以发布三种类型的data,不可以其他复杂的强类型发信息的时不会做编译检测SendMessage WorkflowImplement UnityObject2.jsvar u = new UnityObject2;u.GetUnity();sendmessage():注意:sendmessage是blocking call,call sendMessage在Mono里的一个function是一个死循环会block broswer,所以这些要被call到的methord里我们可以使用Coroutine,来 spli 阅读全文
posted @ 2014-03-25 15:55 若愚Shawn 阅读(828) 评论(0) 推荐(0)
摘要:不可以像其他build target一样读写I/O不可以call一些private或者internal methord只要在一个top level的domain下可以不需要xml dmain policy不在一个domain的话需要写chrossdomain.xml 阅读全文
posted @ 2014-03-25 15:22 若愚Shawn 阅读(229) 评论(0) 推荐(0)
摘要:Unity Web Player | before Unity Web Player | before ... 阅读全文
posted @ 2014-03-25 15:13 若愚Shawn 阅读(395) 评论(0) 推荐(0)
摘要:Good Practice普通的Public变量可以在inspect里显示,变量是可以在inspect里赋值并realtime反映在被attach到的GameObject上的。注意经典public property的写法,在inspect里不会显示You can't new MonoBehaviou... 阅读全文
posted @ 2014-02-07 10:32 若愚Shawn 阅读(510) 评论(0) 推荐(0)
摘要:泛型是什么?这是摘自百度百科中对泛型的介绍:泛型是c#2.0的一个新增加的特性,它为使用c#语言编写面向对象程序增加了极大的效力和灵活性。不会强行对值类型进行装箱和拆箱,或对引用类型进行向下强制类型转换,所以性能得到提高。通过知道使用泛型定义的变量的类型限制,编译器可以在一个高得多的程度上验证类型假设,所以泛型提高了程序的类型安全。它允许程序员将一个实际的数据类型的规约延迟至泛型的实例被创建时才确定。泛型为开发者提供了一种高性能的编程方式,能够提高代码的重用性,并允许开发者编写非常优雅的解决方案。看过之后,会用的还是懂;不会用的,也还是不懂。所以我们还是看看泛型具体在程序中的应用://泛型方法 阅读全文
posted @ 2014-01-07 15:52 若愚Shawn 阅读(2908) 评论(0) 推荐(0)
摘要:ScriptingAre you using the right algorithm? Selecting the right algorithm for a task yields much better optimization than any other code tweaking you might do. Note that the best algorithm is not always the one with the lowest average complexity. For small datasets, it is often better to use a slow 阅读全文
posted @ 2013-02-08 03:23 若愚Shawn 阅读(473) 评论(0) 推荐(0)
摘要:Unity内部的脚本,是通过附加自定义脚本对象到游戏物体组成的。在脚本对象内部不同的函数被特定的事件调用。最常用的列在下面:Awake: 在MonoBehavior创建后就立刻调用Start: 将在MonoBehavior创建后在该帧Update之前,在该Monobehavior.enabled == true的情况下执行。当MonoBehavior没有定义[ExecuteInEditMode]时 总结:我们尽量将其他Object的reference设置等事情放在Awake处理。然后将这些reference的Object的赋值设置放在Start()中来完成。当MonoBehavior有定义[. 阅读全文
posted @ 2013-02-08 03:14 若愚Shawn 阅读(321) 评论(0) 推荐(0)
摘要:http://forum.unity3d.com/threads/44911-2-cameras-running-the-same-time1: 2个camera同时显示在一个屏幕里It is certainly possible to have multiple cameras at once. There are a couple things to know that will help with this:- Cameras have a "depth" property. This determines which order the cameras will d 阅读全文
posted @ 2013-02-07 23:49 若愚Shawn 阅读(280) 评论(0) 推荐(0)
摘要:Unity3D + C#: Cloning the Content of a Serializable ClassFound a pretty simple and neat method for cloning the contents of a serializable class from one to another:http://stackoverflow.com/questions/78536/cloning-objects-in-c-sharpHere's a copy of the script (for Unity use), to make your life ea 阅读全文
posted @ 2013-02-07 23:37 若愚Shawn 阅读(281) 评论(0) 推荐(0)
摘要:How to make a mini map for your scene in Unity3d This is my first tutorial on Unity, kinda nervous writing it... Anyway have you guys ever play Hitman, Dynasty Warrior, Starcraft or any RTS games? Usually at the bottom left of those games, there's a 2d map showing where the players are and where 阅读全文
posted @ 2013-02-07 23:25 若愚Shawn 阅读(1097) 评论(0) 推荐(0)
摘要:Dynamic Texture2D in UnityUICreate Texture2D and assign image to it through a script//需要在最上级Asset folder下建一个Resources folder,然后里面放要dynamic attach的textureusing UnityEngine;using System.Collections;public class TearApartControl : MonoBehaviour { public Texture2D handCursor; // Use this for initi... 阅读全文
posted @ 2013-01-29 06:48 若愚Shawn 阅读(286) 评论(0) 推荐(0)
摘要:Customise mousehover cursorCustom Mouse CursorMouse over change texture项目中我用的方法using UnityEngine;using System.Collections;public class TearApartControl : MonoBehaviour { public Texture2D handCursor; private bool _hitOBject = false; // Use this for initialization void Start () { { ... 阅读全文
posted @ 2013-01-29 06:44 若愚Shawn 阅读(338) 评论(0) 推荐(0)
摘要:Get children gameobjects arrayGet references to all gameobjects that are tagged with a particular tag?Sort an ArrayList of game objects...GameObject assetBundle = GameObject.FindGameObjectWithTag("main"); //找到parent gameobjectTransform[] parts = assetBundle.GetComponentsInChildren<Trans 阅读全文
posted @ 2013-01-29 06:38 若愚Shawn 阅读(193) 评论(0) 推荐(0)
摘要:使用enum propertyBOM2 项目中需要有一个单独的script控制mode的切换,其他scipt根据这个mode切换到哪一个enum来决定该mode下的一些功能的开启。一开 始我用的是inspector的方法,在enum的script里控制enum选择的值,然后在需要做判断的script里创建一个public变量来接 受enum值的变化。后来我改为完全用类的enum方法实现。//ModeSelector.csusing UnityEngine;using System.Collections; public enum ModeEnum { Assembly... 阅读全文
posted @ 2013-01-29 06:30 若愚Shawn 阅读(384) 评论(0) 推荐(0)
摘要:官方文档在这里用的是params加new UnityObject2({ params: params })的方法。BOM2项目中我一度怎么调试customize prograss bar都不出。后来找到原因是我用的另外一个结构(config包含params的方法),本该是params的参数写到了config里了。网页中<script>里正确设置参数的方法:var config = { width : 960, height : 370, params : { disableContextMenu : true, disableFullscreen ... 阅读全文
posted @ 2013-01-13 13:30 若愚Shawn 阅读(557) 评论(0) 推荐(0)
摘要:制作Unity3d的prograss bar:Unity3d在网页下有2种prograss bar:,初次打开unity时的plugin bar(少于1秒,可以简单的custmize 背景颜色和bar的样式)和之后自己可以加入的换场景bar(自己可以选择任意样式的bar),burgzerg网站有视频实例。以下例子是开始的时候loading unity plugin和第一个场景(空场景带一个button),如果build时选的streamed,load完第一个空场景,会继续在后面loading 队列里的其他level。如果没有选择streamed则直接loading完第一个场景后等待用户clic 阅读全文
posted @ 2013-01-12 03:13 若愚Shawn 阅读(341) 评论(0) 推荐(0)
摘要:Event:(Unity3d中的event是用来取代SendMessage机制的)c#的event定义,1:首先需要一个delegate,相当于事件的响应,c#自带了一个EventHandler,接受sender这个object,以及事件参数EventArgs(c#自带的事件参数类型)。你也可以自己写delegate,传自己想传的参数,无需用c#自带的EventHandler和EventArgs。1 public delegate void MyEventHandler(Event evt); 2:其次需要定义一个event,并将事件与你定义的delegate绑定。1 public even. 阅读全文
posted @ 2013-01-02 07:26 若愚Shawn 阅读(293) 评论(0) 推荐(0)
摘要:脚本概览Unity内部的脚本,是通过附加自定义脚本对象到游戏物体组成的。在脚本对象内部不同的函数被特定的事件调用。最常用的列在下面:Update:这个函数在渲染第一帧之前被调用,这里是大部分游戏行为代码被执行的地方,除了物理代码。FixedUpdate:这个函数在每个物理时间被调用一次,这是处理基于物理游戏的地方。在任何函数之外的代码在物体被加载的时候运行,这个可以用来初始化脚本状态。你也能定义事件句柄,它们的名称都以On开始,(例如OnCollisionEnter)。常用操作大多数游戏物体的操作是通过游戏物体的Transform或Rigidbody来做的,在行为脚本内部它们可以分别通过tra 阅读全文
posted @ 2013-01-02 06:29 若愚Shawn 阅读(189) 评论(0) 推荐(0)
摘要:转载:http://blog.csdn.net/jjiss318/article/details/7441824Unity3D博客http://www.dapp.com.br/byDapphttp://www.m2h.nl/unity/byM2Hhttp://www.everyday3d.com/blog/byBartekdrozdzhttp://www.untoldentertainment.com/blog/category/blog/http://unity3dstore.com/byunity3dstorehttp://thecodebook.wordpress.com/bytheco 阅读全文
posted @ 2013-01-02 05:58 若愚Shawn 阅读(307) 评论(0) 推荐(0)
摘要:协同的理解http://blog.163.com/hj_0467/blog/static/74252563201011711845180/http://wg2009perfect.blog.163.com/blog/static/127997663201211111222126/摘要下:1.coroutine, 中文翻译“协程”。这个概念可能有点冷门,不过百度之,说是一种很古老的编程模型了,以前的操作系统里进程调度里用到过,现在操作系统的进程调度都是根据 时间片和优先级来进行轮换,以前是要程序自己来释放cpu的控制权,一直不释放一直也就占用着cpu,这种要求程序自己来进行调度的编程模型应该就叫 阅读全文
posted @ 2013-01-01 13:16 若愚Shawn 阅读(3553) 评论(2) 推荐(1)

1