摘要:
3 ways to define a JavaScript classIntroductionJavaScript is a very flexible object-oriented language when it comes to syntax. In this article you can find three ways of defining and instantiating an object. Even if you have already picked your favorite way of doing it, it helps to know some alterna 阅读全文
摘要:
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 阅读全文
摘要:
Unity内部的脚本,是通过附加自定义脚本对象到游戏物体组成的。在脚本对象内部不同的函数被特定的事件调用。最常用的列在下面:Awake: 在MonoBehavior创建后就立刻调用Start: 将在MonoBehavior创建后在该帧Update之前,在该Monobehavior.enabled == true的情况下执行。当MonoBehavior没有定义[ExecuteInEditMode]时 总结:我们尽量将其他Object的reference设置等事情放在Awake处理。然后将这些reference的Object的赋值设置放在Start()中来完成。当MonoBehavior有定义[. 阅读全文