当前位置: 首页 > 编程日记 > 正文

unity开发入门_Unity游戏开发终极入门指南

unity开发入门

Unity is a great tool for prototyping everything from games, to interactive visualisations. In this article, we run through all you need to know to get started using Unity.

Unity是一个很好的工具,可用于制作从游戏到交互式可视化等所有内容的原型。 在本文中,我们遍历了开始使用Unity所需的所有知识。

First, a little bit about me: I’m a hobbyist unity developer, 3d modeler and graphic designer who’s worked with Unity and Blender for over 5 years. I’m now a Financial Maths student at University College Dublin, and occasionally I do freelance graphic design, web prototyping, and game prototyping.

首先,关于我的一些知识:我是一个业余爱好者统一开发人员,3d建模者和图形设计师,与Unity和Blender共同工作了5年以上。 我现在是都柏林大学金融金融专业的学生,​​偶尔我从事自由图形设计,网络原型制作和游戏原型制作。

介绍 (Introduction)

This article is aimed at anyone who has never used Unity before, but has some previous experience programming or in web design / development. By the end of this article, you should have a good general overview of the engine as well as all the necessary functions and code to start making a basic game.

本文针对的对象是从未使用过Unity的人,但是具有一定的编程或Web设计/开发经验。 到本文结尾,您应该对引擎以及开始制作基本游戏的所有必要功能和代码有一个良好的总体了解。

为什么选择Unity? (Why Unity?)

如果你想做游戏 (If you want to make games)

There’s really very few options when it comes to Indie Game development. The three main choices if you want to build games are Unreal, Unity or GameMaker.

关于独立游戏开发,实际上只有很少的选择。 如果要构建游戏,三个主要选择是虚幻,Unity或GameMaker。

Unity is probably the least opinionated of the 3 platforms. It gives you a very raw product out of the box, but is highly flexible, well-documented, and highly extensible to build pretty much any genre of game you can think of.

在这3个平台中,Unity的观点最少。 它为您提供了非常原始的产品,但具有高度的灵活性,良好的文档记录和高度可扩展性,可以构建您可以想到的几乎所有类型的游戏。

There are plenty of highly successful games such as Escape from Tarkov (FPS), Monument Valley (Puzzler), and This War of Mine (Strategy / Survival) all built in Unity.

有很多非常成功的游戏,例如Unity中内置的《逃离塔尔科夫(FPS)》,《纪念碑谷》(Puzzler)和《矿山之战》(策略/生存)。

In reality the engine you build your first game on is probably not critical, so my advice is just to pick one and go with it.

实际上,您构建第一个游戏的引擎可能并不关键,所以我的建议是选择一个并继续使用。

如果您想原型化用户体验 (If you want to prototype user experiences)

Since unity is just an engine with a bunch of physics, animation, and real time 3d rendering, it’s also a great space to make fully fledged interactive prototypes for UX studies.

由于unity只是具有大量物理,动画和实时3d渲染的引擎,因此它也是为UX研究制作成熟的交互式原型的理想空间。

Unity has full support for VR and AR and hence could be a great tool for exploring architecture, automations and simulations with clients.

Unity全面支持VR和AR,因此可以成为与客户一起探索架构,自动化和仿真的绝佳工具。

本文各节 (Sections to this article)

  • Why Unity?

    为什么选择Unity?

  • Unity Editor Window

    Unity编辑器窗口

  • Unity Game Objects

    Unity游戏对象

  • Unity Builtin Components

    Unity内置组件

  • Creating Custom Components

    创建自定义组件

  • Structure of a MonoBehaviour

    MonoBehaviour的结构

  • Manipulating GameObjects

    操纵游戏对象

  • Raycasting

    射线广播

  • Collision detection

    碰撞检测

  • Advanced Features

    高级功能

  • Advice For Newcomers

    给新人的建议

  • Nice Resources and Communities

    不错的资源和社区

  • Conclusion

    结论

Unity编辑器窗口 (Unity editor window)

The editor window is split up into a couple of sections. We will cover this very briefly as we will refer to it constantly throughout the article. If your familiar with this already just skip past!

编辑器窗口分为几个部分。 我们将在本文中简短地介绍这一点,因为我们会不断对其进行引用。 如果您对此已经熟悉,请跳过过去!

Scene View: Allows placement and movement of GameObjects in the Scene

场景视图:允许在场景中放置和移动游戏对象

Game View: Previews how the player will see the scene from the camera

游戏视图:预览玩家如何从摄像机看到场景

Inspector: Provide details on the selected GameObject in the scene.

检查器:提供有关场景中所选GameObject的详细信息。

Assets / Project: All prefabs, textures, models, scripts etc are stored here

资产/项目:所有预制件,纹理,模型,脚本等都存储在此处

Hierarchy: Enables nesting and structuring of GameObjects within the scene

层次结构:启用场景内GameObject的嵌套和结构化

Now we’re good to start!

现在我们开始吧!

Unity游戏对象 (Unity Game Objects)

什么是游戏对象 (What are GameObjects)

GameObjects are the core building block of everything in the Unity games engine. The name almost gives it away:

GameObjects是Unity游戏引擎中所有内容的核心构建块。 这个名字几乎给了它:

Anything you place within a scene in Unity must be wrapped in a ‘game object.’
您在Unity场景中放置的所有内容都必须包裹在“游戏对象”中。

If you’ve got a web design background, you can think of GameObjects as being a lot like <div> elements! Extremely boring containers, but are highly extensible to create complex functionality or visuals.

如果您具有网页设计背景,则可以认为GameObjects与<div>元素非常相似! 容器非常无聊,但是可以高度扩展以创建复杂的功能或视觉效果。

Literally everything from particle effects, cameras, players, UI elements, … (the list goes on) is a GameObject.

从字面上看,包括粒子效果,相机,播放器,UI元素……(列表不胜枚举)的所有东西都是GameObject。

创建层次结构 (Creating Hierarchy)

Like a <div> in web development, a GameObject is also a container. Just as you nest <div>s to create varied and desirable layouts or abstractions you may wish to do the same with games objects.

就像Web开发中的<div>一样,GameObject也是一个容器。 正如您嵌套<div>来创建各种所需的布局或抽象一样,您可能希望对游戏对象也是如此。

The logic behind nesting game objects is much the same as web development, I’ll give a few examples…
嵌套游戏对象的逻辑与网络开发基本相同,我将举几个例子……

Clutter & Efficiency

混乱与效率

Web Analogy: You’ve got many similar elements which may be dynamically generated on the fly in response to user interaction and want to keep them tidy.

网络类比: 您有许多类似的元素,它们可能会动态生成以响应用户交互,并希望保持它们整洁。

Unity Translation: Your building a Minecraft clone and you’ve loads of blocks in the scene, you need to add and remove ‘chunks’ of blocks from the scene for performance reasons. Thus having them parented to an empty GameObject for each chunk makes sense, as deleting the chunk parent removes all the children blocks.

Unity Translation: 构建Minecraft克隆并且场景中有大量块,出于性能原因,您需要从场景中添加和删除块的“块”。 因此,让它们为每个块添加一个空的GameObject作为父项是有意义的,因为删除父块会删除所有子块。

Positioning

定位

Web Analogy: You want to keep the position of the content contained ‘relative’ to the container and not to the web page.

网络类比: 您想保持包含的内容相对于容器而不是网页的位置。

Unity Translation: You’ve created a bunch of helper drones which hover around the player. You would really not rather write code to tell them to chase after the player, so instead you instantiate them as children of the player game object.

Unity Translation: 您已经创建了一群辅助玩家,它们徘徊在玩家周围。 您实际上并不想编写代码来告诉他们追随玩家,而是将它们实例化为玩家游戏对象的子代。

Unity内置组件 (Unity Builtin Components)

演员组件模型 (The Actor Component Model)

GameObjects on their own are pretty useless — as we’ve seen they’re pretty much just containers. In order to add functionality to them we have to add components, which are essentially scripts written in either C# or Javascript.

单独的GameObjects毫无用处-正如我们已经看到的,它们几乎只是容器。 为了向它们添加功能,我们必须添加组件,这些组件本质上是用C#或Javascript编写的脚本。

Unity works off an Actor Component model, put simply the GameObjects are the actors and the Components are your scripts.

Unity采用Actor Component模型,简单地说GameObjects是actor,而Components是您的脚本。

If you’ve written any web apps before you’ll be familiar with the idea of creating small reusable components such as buttons, form elements, flexible layouts that have various different directives and customisable properties. Then assembling these small components into larger web pages.

如果您已经编写了任何Web应用程序,那么您将熟悉创建小型可重用组件(例如按钮,表单元素,具有各种不同指令和可自定义属性的灵活布局)的想法。 然后将这些小的组件组​​装成较大的网页。

The big advantage of this approach is the level of reusability and clearly defined communication channels between elements. Likewise in game development, we want to minimise the risk of unintended side effects. Small bugs tend to spiral out of control if you’re not careful, and are extremely difficult to debug. Thus creating small, robust and reusable components is critical.

这种方法的最大优势是可重用性级别以及元素之间明确定义的通信渠道。 同样,在游戏开发中,我们希望将意外副作用的风险降至最低。 如果您不小心,小错误往往会失控,并且极难调试。 因此,创建小型,坚固且可重复使用的组件至关重要。

关键的内置组件 (Key Built-in Components)

I think it’s time for a few examples of the built in components provided by the Unity Games engine.

我想是时候来看看Unity Games引擎提供的内置组件的一些示例了。

  • MeshFilter: Allows you to assign materials to a 3D mesh to a GameObject

    MeshFilter:允许您将材质分配给3D网格,然后分配给GameObject

  • MeshRender: Allows you to assign materials to a 3D Mesh

    MeshRender:允许您将材质分配给3D网格

  • [Box | Mesh]Collider: Enables detection of GameObject during collisions

    [箱| Mesh] Collider:可在碰撞期间检测GameObject

  • Rigidbody: Enables realistic physic simulation to act on GameObjects with 3d Meshes and will be trigger detection events on box colliders

    刚体:使逼真的物理模拟能够对具有3d网格的GameObject起作用,并将触发盒对撞机上的检测事件

  • Light: Illuminates portions of your scene

    光线:照亮场景的一部分

  • Camera: Defines the player viewport to be attached to a GameObject

    摄影机:定义要附加到GameObject的玩家视口

  • Various UI Canvas Components for displaying GUIs

    用于显示GUI的各种UI画布组件

There are loads more, but these are the main ones you’ll need to get familiar with. One tip is that you can access all the docs for these through the unity manual and scripting reference offline wherever you are:

还有更多的负载,但是这些是您需要熟悉的主要负载。 一个提示是,无论您身在何处,都可以通过统一手册和脚本参考脱机访问这些文档的所有文档:

创建自定义组件 (Creating Custom Components)

The builtin components control physics and visuals primarily, but to really make a game, you’re going to need to accept user input and manipulate those standard components as well as the GameObjects themselves.

内置组件主要控制物理和视觉效果,但是要真正制作游戏,您将需要接受用户输入并操纵这些标准组件以及GameObjects本身。

To start creating components, go into the desired GameObject > Add Component > type the name of your new component in the search bar > new script (c#).
要开始创建组件,请进入所需的GameObject>添加组件>在搜索栏中>新脚本(c#)输入新组件的名称。

As a general recommendation I’d advise against using Javascript in Unity. It hasn’t been kept updated with all the great stuff that came with ES6, and most of the more advanced stuff relies on C# stuff ported over to Javascript… It just becomes a one giant work-around in my experience.

作为一般建议,我建议不要在Unity中使用Javascript。 尚未随ES6附带的所有出色功能对其进行更新,并且大多数更高级的功能都依赖于移植到Javascript的C#内容……根据我的经验,这只是一个巨大的解决方法。

MonoBehaviour的结构 (Structure of a MonoBehaviour)

关键功能 (Key Functions)

All components inherit from the MonoBehaviour Class. It includes several standard methods, most importantly:

所有组件都继承自MonoBehaviour类。 它包括几种标准方法,最重要的是:

  • void Start() which is called whenever an object containing the script is instantiated in the scene. This is useful anytime we want to perform some initialisation code, eg. set a player’s equipment after they spawn into a match.

    void Start() ,每当在场景中实例化包含脚本的对象时,就会调用该方法。 每当我们想要执行一些初始化代码时,这都是很有用的。 在比赛产生后设置球员的装备。

  • void Update() which is called every frame. This is where the bulk of code involving user input will go, updating various properties such as the motion of the player in the scene.

    void Update() ,每帧都调用一次。 这是涉及用户输入的大量代码的去向,将更新各种属性,例如场景中播放器的运动。

检查器变量 (Inspector Variables)

Often we want to make components as flexible as possible. For example all weapons might have a different damage, rate of fire, has_sight etc. Whilst all the weapons are essentially the same thing we may want to be able to create different variations quickly through the unity editor.

通常,我们希望使组件尽可能地灵活。 例如,所有武器可能具有不同的伤害,射速,has_sight等。虽然所有武器本质上都是同一件事,但我们可能希望能够通过统一编辑器快速创建不同的变体。

Another example where we might want to do this is when creating a UI component that tracks user mouse movements and places a cursor in the viewport. Here we might want to control the sensitivity of the cursor to movements (if the user was using a joystick or gamepad vs a computer mouse). Thus it would make sense to have these variable easy to change both in edit mode and also experiment with them during runtime.

我们可能要执行此操作的另一个示例是在创建一个UI组件时,该组件可以跟踪用户的鼠标移动并将光标放置在视口中。 在这里,我们可能想要控制光标对移动的敏感度(如果用户使用的是操纵杆或游戏板而不是计算机鼠标)。 因此,使这些变量易于在编辑模式下进行更改并在运行时进行试验是有意义的。

We can do this easily by simply declaring them as public variables in the body of the component.

我们只需在组件主体中将它们声明为公共变量即可轻松实现。

接受用户输入 (Accepting user input)

Of course, we want our game to respond to user input. The most common ways to do that are using the following methods in the Update() function of a component (or anywhere else you like):

当然,我们希望我们的游戏能够响应用户输入。 最常见的方法是在组件(或您喜欢的其他任何地方)的Update()函数中使用以下方法:

  • Input.GetKey(KeyCode.W) Returns True W key is being held down

    Input.GetKey(KeyCode.W)返回正按下的W键
  • Input.GetKeyDown(KeyCode.W) Returns True when W key is first pressed

    Input.GetKeyDown(KeyCode.W)首次按下W键时返回True
  • Input.GetAxis(“Vertical”), Input.GetAxis(“Horizontal”) Returns between -1,1 mouse input movement

    Input.GetAxis(“ Vertical”),Input.GetAxis(“ Horizo​​ntal”)返回-1,1鼠标输入之间的移动

操纵游戏对象 (Manipulating GameObjects)

Once we have user input we want GameObjects within our scene to respond. There are several types of responses we may consider:

获得用户输入后,我们希望场景中的GameObjects做出响应。 我们可能会考虑几种类型的响应:

  • Translation, Rotation, Scale

    平移,旋转,比例
  • Create new GameObjects

    创建新的游戏对象
  • Sending messages to existing GameObjects / components

    向现有的GameObjects /组件发送消息

转变 (Transformations)

GameObjects all have a transform property which enable various useful manipulations on the current game object to be performed.

所有游戏对象都具有transform属性,该属性允许对当前游戏对象执行各种有用的操作。

The methods above are fairly self explanatory, just note that we use lowercase gameObject to refer to the GameObject which owns this specific instance of the component.

上面的方法是很容易解释的,只需要注意,我们使用小写的gameObject来指代拥有组件特定实例的GameObject

In general it’s a good practice to use local[Position,Rotation] rather than the global position / rotation of an object. This usually makes it easier to move objects in a manner that makes sense, as the local space axis will be oriented and centered on the parent object rather than the world origin and x,y,z directions.

通常,最好使用local [Position,Rotation]而不是对象的全局位置/旋转。 由于局部空间轴将定向并居中放置在父对象上,而不是世界原点和x,y,z方向,因此这通常使以一种有意义的方式移动对象变得更加容易。

If you need to convert between local and world space (which often is the case) you can use the following:

如果需要在本地空间和世界空间之间转换(通常是这种情况),可以使用以下方法:

As you can imagine, there is some fairly simple linear algebra behind this hinted at by the ‘Inverse’ in the method name.

如您所料,方法名称中的“反”表示了一些相当简单的线性代数。

创建新的游戏对象 (Creating new GameObjects)

Since GameObjects are basically everything in your scene, you might want to be able to generate them on the fly. For example if your player has some sort of projectile launcher you might want to be able to create projectiles on the fly which have their own encapsulated logic for flight, dealing damage, etc…

由于GameObjects基本上是场景中的所有内容,因此您可能希望能够即时生成它们。 例如,如果您的玩家使用某种弹丸发射器,则您可能希望能够动态创建具有自己封装的逻辑(用于飞行,造成伤害等)的弹丸……

First we need to introduce the notion of a Prefab. We can create these simply by dragging any GameObject in the scene hierarchy into the assets folder.

首先,我们需要介绍Prefab的概念。 我们可以简单地通过将场景层次结构中的任何GameObject拖动到资产文件夹中来创建它们。

This essentially stores a template of the object we just had in our scene with all the same configurations.

这实际上存储了我们在场景中拥有相同配置的对象的模板。

Once we have these prefab components we can assign them to inspector variables (as we talked about earlier) on any component in the scene, so that we can create new GameObjects as specified by the prefab at any time.

一旦有了这些预制组件,我们就可以将它们分配给场景中任何组件上的检查器变量(如我们前面所述),以便我们可以随时创建由预制指定的新GameObject。

We can then perform ‘instantiation’ of the prefab and manipulate it to the desired location in the scene and establish the necessary parent relationships.

然后,我们可以对预制件执行“实例化”,并将其操纵到场景中所需的位置,并建立必要的父级关系。

访问其他游戏对象和组件 (Accessing other GameObjects and Components)

Often we need to communicate with other GameObjects as well as their associated components. Once you have a reference to a game object this is pretty simple.

通常,我们需要与其他GameObject及其关联的组件进行通信。 引用游戏对象后,这非常简单。

ComponentName comp = some_game_object.GetComponent<ComponentName>();
ComponentName comp = some_game_object.GetComponent <ComponentName>();

After that you can access any of the public methods / variables of the component in order to manipulate the GameObject. This is the straightforward bit, however actually obtaining the reference to the GameObject can be done in several ways…

之后,您可以访问组件的任何公共方法/变量以操纵GameObject。 这很简单,但是实际上可以通过几种方式获得对GameObject的引用。

通过检查器变量访问 (Access via inspector variable)

This is the most straightforward. Simply create a public variable for the GameObject, as we’ve demonstrated earlier with the prefabs, and manually drag and drop it onto the component via the inspector. Then access the variable as above.

这是最直接的。 只需为GameObject创建一个公共变量(如我们之前在预制件中所展示的),然后通过检查器将其手动拖放到组件上即可。 然后按上述方式访问变量。

通过标签访问 (Access via tagging)

We can tag GameObjects or prefabs via the inspector and then use the find game object functions to locate references to them.

我们可以通过检查器标记GameObjects或预制件,然后使用find游戏对象功能找到对它们的引用。

This is simply done as below.

只需按照以下步骤即可完成。

GameObject some_game_object = GameObject.FindGameObjectWithTag(“Brick”);
GameObject some_game_object = GameObject.FindGameObjectWithTag(“ Brick”);

通过转换访问 (Access via transform)

If we wish to access components in some parent object we can easily do this via the transform attribute.

如果我们希望访问某些父对象中的组件,则可以通过transform属性轻松实现。

ComponentName comp = gameObject.transform.parent.GetComponent<ComponentName>();
ComponentName comp = gameObject.transform.parent.GetComponent <ComponentName>();

通过SendMessage访问 (Access via SendMessage)

Alternatively if we want to send a message to many other components or wish to message an object which is far up a nested hierarchy, we can use the send message functions, which accept the name of the function followed by the arguments.

另外,如果我们想向其他许多组件发送消息或希望向嵌套层次结构中远一个对象发送消息,则可以使用send message函数,该函数接受函数名和参数。

gameObject.SendMessage(“MethodName”,params); // Broadcast message
gameObject.SendMessage(“ MethodName”,params); // 广播消息
gameObject.SendMessageUpwards(“MethodName”, params); // Only received by components which are nested above.
gameObject.SendMessageUpwards(“ MethodName”,params); //仅由嵌套在上面的组件接收。

射线广播 (Raycasting)

You may have heard of this before when people compare FPS games that are ‘physics based’ or ‘ray based’. Raycasting is essentially like having a laser pointer which, when it comes into contact with a ‘collider’ or ‘rigidbody’, it returns a ‘hit’ and passes back the details of the object.

在人们比较“基于物理学”或“基于射线”的FPS游戏之前,您可能已经听说过这一点。 射线投射本质上就像是一个激光指示器,当它与“对撞机”或“刚体”接触时,它会返回“命中”并传回对象的详细信息。

There are two scenarios where this comes in handy (There’s probably loads more):

在两种情况下可以派上用场(可能有更多负载):

  1. If you were designing a weapon system for a game, you could use raycasting for hit detection, and even customise the length of the ray so that melee items ‘hit’ only at short ranges

    如果您正在为游戏设计武器系统,则可以使用射线投射进行命中检测,甚至可以自定义射线的长度,以使近战物品只能在短距离内“命中”
  2. Create a ray from the mouse pointer to a point in 3d space, ie if you wish the user to be able to select units with their mouse in a strategy game.

    创建从鼠标指针到3d空间中某个点的光线,即,如果您希望用户能够在策略游戏中使用鼠标选择单位。

As you can see, the code for this is a little bit more involved. The key thing to understand is that to cast a ray to where the mouse is pointing in 3d space requires the ScreenPointToRay transformation. The reason for this is the camera is rendering a 3d space as a 2d viewport on your laptop screen, so naturally there is a projection involved to transfer back to 3d.

如您所见,此代码涉及更多。 要理解的关键是将射线投射到鼠标在3d空间中指向的位置需要ScreenPointToRay转换。 原因是相机在笔记本电脑屏幕上将3d空间作为2d视口渲染,因此自然会有一个投影转移回3d。

碰撞检测 (Collision detection)

Earlier we mentioned the Collider and Rigidbody components which can be added to an object. The rule for collisions is that one object in the collision must have a rigidbody and the other a collider (or both have both components). Note that when using raycasting, rays will only interact with objects with collider components attached.

前面我们提到了可以添加到对象中的Collider和Rigidbody组件。 碰撞的规则是,碰撞中的一个对象必须具有刚体,而另一个必须具有碰撞体(或两者都有)。 请注意,在使用光线投射时,光线只会与附加了对撞机组件的对象进行交互。

Once setup within any custom component attached to the object, we can use the OnCollisionEnter, OnCollisionStay and OnCollisionExit methods to respond to collisions. Once we have the collision information we can get the GameObject responsible and use what we learned earlier to interact with components attached to it as well.

一旦在附加到对象的任何自定义组件中进行设置,我们就可以使用OnCollisionEnter,OnCollisionStay和OnCollisionExit方法来响应碰撞。 一旦获得了碰撞信息,我们就可以让GameObject负责并使用我们先前学到的知识来与连接到它的组件进行交互。

One thing to note is that rigid-bodies provide physics such as gravity for objects, so if you want this turned off you will need to check the is_kinematic on.

要注意的一件事是,刚体为物体提供了诸如重力之类的物理特性,因此,如果要禁用此功能,则需要检查is_kinematic是否启用。

高级功能 (Advanced Features)

We won’t go into any of this now but perhaps in a future article — just to make you aware that they exist.

我们现在不会讨论任何内容,但可能会在以后的文章中进行介绍,只是为了使您知道它们的存在。

创建GUI的 (Creating GUI’s)

Unity has a fully fledged UI engine for laying out the GUI for your game. In general these components work pretty similarly to the rest of the engine.

Unity具有完善的UI引擎,可为游戏布置GUI。 通常,这些组件的工作原理与引擎的其余部分非常相似。

扩展Unity编辑器 (Extending the Unity Editor)

Unity enables you to add custom buttons to your inspectors so that you can affect the world during edit mode. For example, to help with world building you might develop a custom tool window for building modular houses.

Unity使您可以将自定义按钮添加到检查器,以便您可以在编辑模式下影响整个世界。 例如,为了帮助进行世界构建,您可以开发用于构建模块化房屋的自定义工具窗口。

动画 (Animation)

Unity has a graph-based animation system which enables you to blend and control animations on various objects such as players implementing a bone based animation system.

Unity有一个基于图形的动画系统,使您可以混合和控制各种对象上的动画,例如实现基于骨骼的动画系统的播放器。

材料和PBR (Materials and PBR)

Unity runs off a physically-based rendering engine which enables real time lighting and realistic materials. The reality is you will either need to learn 3d modeling first or use models made and optimised by someone else before you get to this, in order to make stuff that actually looks good.

Unity运行于基于物理的渲染引擎,该引擎可实现实时照明和逼真的材质。 现实情况是,您需要先学习3D建模,或者使用其他人制作和优化的模型才能制作出看起来不错的东西。

给新人的建议 (Advice For Newcomers)

If you’re planning on writing your first game, don’t underestimate the complexity and time it takes to write even the most trivial of games. Remember most of the games that come out on Steam have teams working on them for years full-time!

如果您打算编写第一个游戏,请不要低估编写最琐碎游戏的复杂性和时间。 请记住,Steam上发布的大多数游戏都拥有专门从事多年工作的团队!

Pick a simple concept and break it down into small achievable milestones. It’s highly recommended to separate your game into as small independent components as possible, as you’re much less likely to run into bugs if you keep the components simple rather than monolithic code blocks.

选择一个简单的概念,并将其分解为可实现的较小里程碑。 强烈建议将您的游戏分成尽可能小的独立组件,因为如果使组件保持简单而不是单块代码块,则您遇到错误的可能性将大大降低。

Before you go and write any code for any part of your game, go and research what someone else has done before to solve the same problem — chances are they’ll have a much slicker solution.

在继续为游戏的任何部分编写任何代码之前,请研究其他人在解决同一问题之前所做的工作-他们可能会拥有更为精巧的解决方案。

不错的资源和社区 (Nice Resources and Communities)

Game design has one of the best communities of any out there, and there are loads of highly skilled pros in the industry who put content up for free or for next to nothing. It’s a field that requires 3d Modelers, Concept Artists, Game Designers, Programmers and so on. I’ve linked some great general resources that I’ve come across for each of these fields below:

游戏设计是目前为止最好的社区之一,并且行业中有大量熟练的专业人士,他们免费或几乎没有内容提供内容。 这个领域需要3D建模者,概念艺术家,游戏设计师,程序员等。 我已经为下面的每个领域链接了一些很棒的常规资源:

Concept Art

概念艺术

  • Feng Zhu Design School (Over 90 hour long concept art tutorials)

    枫竹设计学校 (超过90个小时的概念艺术教程)

  • Tyler Edlin Art (Great BST art community with feedback from pros on monthly challenges)

    泰勒·埃德林艺术 ( Tyler Edlin Art) (伟大的BST艺术社区,专业人士对每月的挑战提供反馈)

  • Art Cafe (Interviews and Workshops with Famous Concept Artists)

    艺术咖啡馆 (著名概念艺术家的访谈和工作坊)

  • Trent Kaniuga (Illustrator and 2D artist who’s also making his own game)

    Trent Kaniuga (插画家和2D艺术家,他也在制作自己的游戏)

3D Modelling

3D建模

  • CG Cookie (Best Mesh Modeling Basics in Blender Ever, they’ve loads of other excellent content for blender)

    CG Cookie (Blender中最好的网格建模基础,他们为Blender提供了许多其他出色的内容)

  • Tor Frick (Hard Surface Modelers & Sculptors in Blender)

    Tor Frick (Blender中的硬表面建模器和雕刻器)

  • Gleb Alexandrov (Short powerful rendering tutorials in Blender)

    Gleb Alexandrov (Blender中的简短强大的渲染教程)

Game Design

游戏设计

  • DoubleFine Amnesia Fortnight (GameDevs who do a 2 week hackathon and record their entire design process)

    DoubleFine失忆双周 (GameDevs,他们进行了为期2周的黑客马拉松并记录了整个设计过程)

  • GameMakers Toolkit (Examines Game Design Principles)

    GameMakers Toolkit (检查游戏设计原理)

Programming

程式设计

  • Handmade Hero (Writing a game and engine from scratch in C)

    手工英雄 (用C语言从头开始编写游戏和引擎)

  • Jonathan Blow (Indie dev who livestreams his game development)

    Jonathan Blow (直播游戏开发的独立开发者)

  • Brackeys (Nice Unity Tutorials)

    Brackeys (Nice Unity教程)

结论 (Conclusion)

Hope you guys liked this tutorial! I do a bit of graphic design work as well as game and UI prototypes so check out my portfolio! I’m also on linked in.

希望你们喜欢本教程! 我会做一些图形设计工作以及游戏和UI原型,所以请查看我的投资组合 ! 我也在链接中

Portfolio | LinkedIn

作品集 | 领英

翻译自: https://www.freecodecamp.org/news/the-ultimate-beginners-guide-to-game-development-in-unity-f9bfe972c2b5/

unity开发入门

相关文章:

uvalive 3218 Find the Border

题意&#xff1a;一条封闭折线将平面分成了若干个区域&#xff0c;按顺序给出折线各点的坐标&#xff0c;要求输出封闭折线的轮廓。 题解&#xff1a;用类似卷包裹的算法&#xff0c;先确定一个一定会被选中的点(x坐标最小&#xff0c;y坐标最小)作为起点&#xff0c;然后把可…

[Mac] mac linux 多线程下载利器 axel

​> 之前做过一些文件下载的统计&#xff0c;发现谷歌浏览器chrome和火狐firefox, 一般都是单线程的下载文件&#xff0c;360浏览器却是多线程的下载。如今切换到了mac上&#xff0c;发现没有360哪个浏览器&#xff0c;就像找个在linux或者mac下能够多线程下载的工具。 linu…

antd 表单提交,文件和表单内容一起提交,表单校验

用很简单的源码实现包含下列 antd 表单相关知识: 1.表单必填校验,规则校验 2.Upload 上传图片,获取上传图片的状态,如上传成功,上传失败,上传进度条,删除上传的文件 3.获取 Input 组件用户输入的值,设置默认值 4.提交表单不刷新页面 5.把上传的图片显示在页面 页面…

代码注释//_您应该停止编写//的五个代码注释,并且//应该开始的一个注释

代码注释//提供来自您最喜欢和最受欢迎的开源项目的示例-React&#xff0c;Angular&#xff0c;PHP&#xff0c;Pandas等&#xff01; (With examples from your favorite and most popular open source projects — React, Angular, PHP, Pandas and more!) 代码质量与注释之间…

eclipse安装maven

maven 下载地址&#xff1a;http://maven.apache.org/download.cgi 1.maven环境配置 将下载的maven解压到某一盘下&#xff0c;进入E:\maven\apache-maven-3.3.9\conf目录&#xff0c;修改setting.xml文件 找到<localRepository>节点&#xff0c;配置本地仓库的地址&…

微信小程序 循迹功能制作

规划地图的路径&#xff0c;实时获取用户当前的定位&#xff0c;进行路线循迹导航功能的开发&#xff1a; 效果图&#xff1a; 实现代码&#xff1a; <map id"map" enable-satellite longitude"{{longitude1}}" latitude"{{latitude1}}" sca…

DOM解析和SAX解析的区别

DOM解析和SAX解析的区别 博客分类&#xff1a; XMLDOM SAX DOM解析和SAX解析的区别 No区 别DOM解析SAX解析1操作将所有文件读取到内存中形成DOM树&#xff0c;如果文件量过大&#xff0c;则无法使用顺序读入所需要的文件内容&#xff0c;不会一次性全部读取&#xff0c;不受文件…

java编写代码用什么_如何学习用Java编写代码:为什么要学习以及从哪里开始

java编写代码用什么by John Selawsky约翰塞劳斯基(John Selawsky) 如何学习用Java编写代码&#xff1a;为什么要学习以及从哪里开始 (How to learn to code in Java: why you should and where to start) Define your career goals and choose a language. This is the most i…

迷宫寻宝(搜索)

迷宫寻宝&#xff08;一&#xff09; 时间限制&#xff1a;1000 ms | 内存限制&#xff1a;65535 KB难度&#xff1a;4描述一个叫ACM的寻宝者找到了一个藏宝图&#xff0c;它根据藏宝图找到了一个迷宫&#xff0c;这是一个很特别的迷宫&#xff0c;迷宫里有N个编过号的门&…

理解Python的迭代器(转)

原文地址: http://python.jobbole.com/81916/ 另外一篇文章: http://www.cnblogs.com/kaituorensheng/p/3826911.html 什么是迭代 可以直接作用于for循环的对象统称为可迭代对象(Iterable)。 可以被next()函数调用并不断返回下一个值的对象称为迭代器(Iterator)。 所有的Iterab…

快捷导航动画制作

做了一个仿大众点评的快捷导航动画效果&#xff0c;点击导航内的箭头&#xff0c;导航缩放&#xff0c;点击快捷导航再伸展。 看效果图&#xff1a; 实现代码&#xff1a; <block wx:if"{{!isCustom}}"><view class"home_and_reSource" animati…

instant apps_Android Instant Apps 101:它们是什么以及它们如何工作

instant appsby Tomislav Smrečki通过TomislavSmrečki Android Instant Apps are a cool new way to consume native apps without prior installation. Only parts of the app are downloaded and launched, giving the users a native look and feel in a couple of secon…

数据库分享一: MySQL的Innodb缓存相关优化

无论是对于哪一种数据库来说&#xff0c;缓存技术都是提高数据库性能的关键技术&#xff0c;物理磁盘的访问速度永 远都会与内存的访问速度永远都不是一个数量级的。通过缓存技术无论是在读还是写方面都可以大大提 高数据库整体性能。Innodb_buffer_pool_size 的合理设置Innodb…

用过美德乐吸奶器的宝妈们感觉比国产吸奶器怎么样啊?

药效好不好&#xff0c;看疗效就知道。吸奶器好不好看评价就知道。我们来看看美德乐吸奶器 天猫旗舰店 : http://medela.wang 的宝妈们的评价如可 拔奶神器&#xff0c;绝对好过贝亲&#xff01;最初一次七八十&#xff0c;后来一百多&#xff0c;现在可以翻个倍。结合宝宝吮吸…

小程序地图多个 circles 使用demo

效果图&#xff1a; 代码&#xff1a; var that; const app getApp() const util require("../../utils/util.js") const data require("../../utils/map.js") Page({data: {pageShow: false,scale: 15,obj: {},longitude: 116.34665554470486,latitud…

编写文档_如何通过编写优质文档来使自己的未来快乐

编写文档by Gabriele Cimato加布里埃莱西马托(Gabriele Cimato) 如何通过编写优质文档来使自己的未来快乐 (How to make your future self happy by writing good docs) 或者&#xff0c;在清除旧代码库时如何减少痛苦 (Or how to be less miserable when dusting off an old …

(转载)人人都会OSGI--实例讲解OSGI开发

http://longdick.iteye.com/blog/457310转载于:https://www.cnblogs.com/eecs2016/articles/7422310.html

小程序json字符串转 json对象 { name :你好} 转成 { name :你好}

解决后端接口返回 var obj "{ name :"你好"}" 类似这样的数据&#xff0c;对象或者数组外面包了一层引号&#xff0c; 把这种数据转成 var obj { name :"你好"}&#xff1b; 直接上代码&#xff1a; // pages/test/test.js Page({jsonStrToJ…

每天写的叫工作日志,每周写的总结叫周报,每月写的叫月报

有些时候&#xff0c;老板会突发让您求每天都要写工作周报&#xff0c;什么项目什么任务&#xff0c;完成情况&#xff0c;完成花费的时间等&#xff0c;然后汇总部门周报&#xff1b;也不是写不出&#xff0c;只是不知道有时候重复做一个项目&#xff0c;到底每天有什么好写&a…

为什么分散刷新没有死时间_分散项目为何失败(以及如何处理)

为什么分散刷新没有死时间The most exciting thing about working in the decentralized economy is the fact that no one has any idea as to where it’ll all end up!在去中心decentralized economy工作最令人振奋的事情是&#xff0c;没有人知道最终的结果&#xff01; T…

.NET Core 常用加密和Hash工具NETCore.Encrypt

前言 在日常开发过程中&#xff0c;不可避免的涉及到数据加密解密&#xff08;Hash&#xff09;操作&#xff0c;所以就有想法开发通用工具&#xff0c;NETCore.Encrypt就诞生了。目前NETCore.Encrypt只支持.NET Core ,工具包含了AES,DES,RSA加密解密&#xff0c;MD5&#xff0…

url 通配符解析成参数

需求&#xff1a;url 参数是通配符&#xff0c;需要把通配符解析成参数并且拼接到 url 中 例如&#xff1a;https://xxx.cn/index.html$a1$b2; 解析成 https://xxx.cn/index.html?a1&b2; 时间关系&#xff0c;直接上代码&#xff0c;有时间再补上注释 下面是小程序页…

性能测试分享:系统架构

性能测试分享&#xff1a;系统架构 转载于:https://www.cnblogs.com/poptest/p/4904584.html

graphql是什么_为什么GraphQL是避免技术债务的关键

graphql是什么GraphQL (not to be confused with GraphDB or Open Graph or even an actual graph) is a remarkably creative solution to a relatively common problem: How do you enable front end developers to access backend data in exactly the way they need it?Gr…

JS如何判断json是否为空

1、判断json是否为空 jQuery.isEmptyObject()&#xff1b; 2、遍历json function getHsonLength(json{var jsonLength0;for (var i in json){jsonLength;}return jsonLength;}转载于:https://www.cnblogs.com/donaldworld/p/7423811.html

微软算法100题11 求二叉树中两节点之间的最大距离

第11 题求二叉树中节点的最大距离...如果我们把二叉树看成一个图&#xff0c;父子节点之间的连线看成是双向的&#xff0c;我们姑且定义"距离"为两节点之间边的个数。写一个程序&#xff0c;求一棵二叉树中相距最远的两个节点之间的距离 思路: 一棵树中节点的最大距…

小程序订阅消息 订阅消息开发

微信小程序交流QQ群&#xff1a; 173683895 173683866 526474645 。 群内打广告或者脏话一律飞机票 订阅消息 当用户勾选了订阅面板中的“总是保持以上选择&#xff0c;不再询问”时&#xff0c;模板消息会被添加到用户的小程序设置页&#xff0c;通过 wx.getSetting…

meetup_如何使用标准库和Node.js构建Meetup Slack机器人

meetupby Janeth Ledezma简妮丝莱德兹玛(Janeth Ledezma) 如何使用标准库和Node.js构建Meetup Slack机器人 (How to build a Meetup Slack bot with Standard Library and Node.js) In this guide, you will learn how to set up a Slack application that will display infor…

.NET使用OpenSSL生成的pem密钥文件[1024位]

using System; using System.Text; using System.Security.Cryptography; using System.Web; using System.IO;namespace Thinhunan.Cnblogs.Com.RSAUtility {public class PemConverter{/// <summary>/// 将pem格式公钥转换为RSAParameters/// </summary>/// <…

[2014百度之星资格赛]

第一个问题&#xff1a; Energy Conversion Problem Description魔法师百小度也有遇到难题的时候——如今。百小度正在一个古老的石门面前&#xff0c;石门上有一段古老的魔法文字&#xff0c;读懂这样的魔法文字须要耗费大量的能量和大量的脑力。过了许久。百小度最终读懂魔法…