- Unity 3.x Game Development by Example Beginner's Guide
- Ryan Henson Creighton
- 210字
- 2021-04-02 18:34:11
You'll never go hungry again
A function is a piece of the script that can be executed, or called, over and over again. It's like having a sandwich that you can eat as many times as you want. We use functions to organize our code, and to house lines of code that we may need more than once.
The function we used is called Update
. Just as there's an ongoing physics process in the background of our game that we can tap into to make our ball move and bounce, there's an ongoing Update
loop as well. Update
is eaten (or called) again and again and again while our game runs. Any script lines, or statements, that we put inside the Update
function tap into that loop.
Notice the way the Update
function is declared. On a restaurant menu, we might declare that our Street-Fightin' Hoagie is a scrumptious offering of mile-high pastrami with lettuce, tomatoes, bacon, and cucumbers, topped with a fried egg and slathered with mustard. We can declare a function much more simply. It starts with the word function
, and adds the function name and a pair of round brackets. If our hoagie was a JavaScript function, it might look like this:
function Hoagie() { }
- Building a Game with Unity and Blender
- C# 從入門到項目實踐(超值版)
- C語言程序設計基礎與實驗指導
- JavaFX Essentials
- C語言程序設計立體化案例教程
- Windows Server 2012 Unified Remote Access Planning and Deployment
- FFmpeg入門詳解:音視頻原理及應用
- 深入淺出PostgreSQL
- Getting Started with Greenplum for Big Data Analytics
- jQuery炫酷應用實例集錦
- Citrix XenServer企業運維實戰
- Go語言編程
- Elasticsearch Essentials
- Java高手是怎樣煉成的:原理、方法與實踐
- Java從入門到精通(視頻實戰版)