Index

Symbols

3D space

navigating 260

A

abstract classes 302

example 302, 303

abstracting 122

access modifiers 50, 288

const 288

implementing 51

internal 51

private 51

protected 51

public 51

readonly 289

reference link 288

static 289, 290

using 50

actions

delegating 390, 391

AI Navigation package

installing 261, 262

animations 169

creating, in code 169-171

creating, in Unity Animation window 171-174

curves, handling 177, 178

keyframes, recording 174-177

tangents, adjusting 179

Animation window 169

Animator window 169

arithmetic operators 60

arrays 92, 93

indexing 93

multidimensional arrays 94

range exceptions 95

subscripts 93

asset paths

working with 342, 343

assignment operators 61, 62

B

bloated file 132

built-in types 52-55

reference link 53

C

C#

files, syncing 18

reference link, for topics 23

reference link, for types 50

resources 411

resources, locating 23, 24

scripts 14-16

using, with Unity 14

writing rules 46, 47

calling code 130

Camel Casing 58

camera behavior

scripting 192-194

C# Corner

reference link 411

Character Controller component

reference link 182

classes 36, 408

blueprints 37

communication 37

constructors, using 120-122

defining 116, 117

extensions 304-307

fields, adding 118, 119

methods, declaring 122, 124

objects, instantiating 117

reference link 36

scope 59

code

debugging 47, 48

collections 92

arrays 92, 93

lists 96, 97

Collider component 196, 201, 202

Collider notifications

reference link 203

Collider triggers

object trail 209

used, for creating enemy 206-208

using 205

collision 201

Health_Pickup object, updating 203-205

reference link 203

combined modifiers

reference link 51

comments

adding 39

multi-line comments 39

single-line comment 38

working with 38

Component design pattern 209

components 40, 41

composition 134

constant 288

constraint type parameters 386-388

constructor overloading 121

CRUD (Creating, Reading, Updating, and Deleting) 358

custom types 57

D

data

serializing 363, 364

data formats 336

JSON (JavaScript Object Notation) 336

text 336

XML (Extensible Markup Language) 336

debug delegate

creating 391, 392

debugging 47, 48

decrementing 104

defensive programming 273, 400

deferred execution 324

delegates

as parameter types 392, 393

reference link 325

deserializing 364

design patterns 409

Development Mode 41, 42

dictionary 99, 338

creating 100, 101

declaring 100

initializing 100

dictionary pairs

working with 101, 102

directories

creating 344

deleting 345

Don’t Repeat Yourself (DRY) principle 34, 122, 283, 344

Dot Net Perls

reference link 411

dot notation 38, 48

E

encapsulation 130, 131

enemy

moving 270-274

enemy agents

moving 266

setting up 264-266

enemy game mechanics 274

bullet collisions, detecting 278-280

destination, modifying of agent 274-276

game manager, updating 280-283

player health, lowering 276-278

enumeration type 212-214

example 215, 216

error handling 399

events

creating 394-396

firing 394

invoking 396

event subscriptions

cleaning up 398, 399

handling 396-398

exceptions

handling 399

throwing 400, 401

explicit conversions 56

F

files 346

creating 346-348

deleting 353

updating 349-352

filesystem 339-341

first-in-first-out (FIFO) model 318

foreach loops 107, 108

looping through key-value pairs 108, 109

for loop 103-106

frames per second (FPS) 72

G

game design 146

art style 146

concept 146

control schemes 146

core mechanics 146

Hero Born one-page 147, 148

story 146

win and lose conditions 146

game design documents 146

Game Design Document (GDD) 146

one-page 147

Technical Design Document (TDD) 146

game levels

3D space, working in 151, 152

building 148

Materials, using 152-154

primitives, creating 148-150

white-boxing 155, 156

game manager

creating 229

item collection, upgrading 234, 235

player properties, tracking 229-231

GameObject in Unity

components, accessing 138

components, accessing in code 138-140

drag and drop functionality 141

objects 137, 138

generic class 380

conversion error 384

example 380-382

generic method 138, 382, 383

generic programming 379

generics 380

adding, to Unity objects 389

get property 231-233

global scope 58

GUI, Hero Born

namespace, used for restarting game 251-256

player stats, displaying 236-246

using directives, used for pausing game 251-256

win and loss conditions, setting 246-251

H

HashSets

operations, performing 321, 322

using 320, 321

Hero Born

game manager, creating 229

GUI, creating 236

jumps, adding 211

shooting projectiles 222

Hero Born one-page 147, 148

I

if-else statement 76-80, 86

multiple conditions, evaluating 83-86

nesting 82, 83

NOT operator, using 80-82

implicit conversions 55

incrementing 104

index 93

inferred declarations 56

inheritance 131

base constructors 132-134

Input System

reference link 188

instances 117

instantiation 117

interfaces 296

example 298-301

iteration statements 103

foreach loops 107, 108

for loops 103-106

while loops 109-112

J

Join GitHub

URL 413

JSON (JavaScript Object Notation) 336-339

deserializing 375, 376

reference link 336

serializing 369-374

K

keywords 49

kinematic movement 196

L

Lambda expressions 327, 328

Language Integrated Query (LINQ) 323

basics 324-326

data, transforming into new types 329, 330

queries 324

queries, chaining 328, 329

simplifying, with optional syntax 331, 332

last-in-first-out (LIFO) model 312

layer masks

working with 216-222

Light component

properties 168

lighting 165

precomputed lighting 166

real-time lighting 165

Light Probe Groups 167

lights

creating 166

LINQ query comprehension syntax 331

List class methods

reference link 99

lists 96, 97

accessing 98

modifying 98, 99

local scope 59

Local space 160

LTS (Long Term Support) version 5

M

match expression 87

Materials

using 152-154

member scope 59

memory address 28

method overloading 291-293

methods 32, 291

actions 33

as arguments 71

declaring 63-65

defining 62, 63

logic detours 65

naming conventions 65

parameters, specifying 66, 67

placeholders 33-35

reference link 33

return values, specifying 68, 69

return values, using 69, 70

Microsoft Learn documentation

reference link 23

MonoBehaviour 43

in Scripting API 43

reference link, for methods 71

multidimensional arrays 94

multi-line comments 39

multiple generic types

using, in single class 384, 385

N

namespace 251

namespace conflicts 307

navigation

components 260

NavMesh

creating 262, 263

NavMeshAgent 260

NavMeshObstacle 260

non-generic method 382

example 383, 384

non-kinematic movement 196

O

object build-up

managing 228, 229

object-oriented programming (OOP) 116, 296, 408, 409

applying, in Unity 136

composition 134

encapsulation 130

inheritance 131

polymorphism 135, 136

object rotations and orientation, in Unity

reference link 200

objects

instantiating 222, 224

operators 60

arithmetic operators 60

assignment operators 61, 62

out parameters 295

P

parent object 159

patrol locations

referencing 267-269

player movement

managing 182

with Transform component 183-185

Play Mode 41, 42

polymorphism 135, 136, 409

precomputed lighting 166

Precomputed Realtime Global Illumination 166

Prefabs 161

working with 161-164

primitives

creating 148-150

using 148

ProBuilder tool 148

reference link 148

procedural programming 266

programming paradigm

reference link 136

protected keywords

reference link 49

Q

queues

features 319, 320

working with 318, 319

R

readonly keyword 289

real-time lighting 165

area lights 167

directional lights 167

point lights 167

spotlights 167

refactoring 283

Reference Manual 19-22

reference types 116, 127, 128

Reflection Probes 167

ref parameters 293-295

Rigidbody2D component

reference link 201

Rigidbody component 195-200

Rigidbody scripting

reference link 201

S

Scripting Reference 19-22

scripts 36, 40

selection statements 75, 76

if-else statement 76-80

switch statement 86

SerializeField

reference link 138

serializing 363

set property 231-233

shooting mechanic

adding 225-227

shooting projectiles 222

single-line comment 38

spaghetti code 34

Stack Overflow

reference link 411

stacks

methods 317, 318

peeking 316, 317

Peek method 316

Pop method 316

popping 316, 317

working with 312-315

Standard Assets package

reference link 183

Start method 71, 72

statement 46

static keyword

using 289, 290

StreamReader

using 354-358

Stream resources

managing 354

streams

closing, automatically 363

working with 353, 354

StreamWriter

using 354-356

string 54

interpolation 54

structs 124, 409

declaring 124-127

subscript operator 93

switch pattern matching

reference link 91

switch statement 86

fall-through cases 89-91

pattern matching 87-89

T

text 336

TextMeshPro

reference link 237

Transform component

player input, obtaining 187-189

player, moving 189-192

using, in player movement 183-185

vectors 185-187

try-catch

using 402-405

type aliasing 307

type and value declarations 49

type conversions 55

explicit conversions 56

implicit conversions 55

type-only declarations 49

types 213

reference link 213

working with 52

type-safe language 52

U

UI Documents (UXML) 236

UI options

reference link 236

UI Toolkit 236

reference link 236

underlying type 213

Unity

3D space, navigating 260

class 36

C#, using with 14

documentation, accessing 19-22

homepage 3

object-oriented programming (OOP), applying 136

referencess, for video tutorial community on YouTube 411, 412

resources 411, 412

URL 3

Unity 2022

editor, navigating 12-14

environment, setting up 3-8

macOS, using 9

project, creating 10, 11

Unity Answers

URL 22, 411

Unity Asset Store

URL 413

Unity certifications 412

reference link 412

Unity Discord

URL 22, 411

Unity download archive 9

Unity Forum

URL 22, 411

Unity Hub

URL 8

Unity Learn

reference link 411

Unity methods 71

Start method 71

Update method 72

Unity objects

generics, adding to 389

Unity physics system

Collider component 201, 202

Collider triggers, using 205

overview 209

Rigidbody component 197-200

working with 195-197

Unity projects

approaching 410

Unity Store

URL 3

Unity UI (uGUI) 236

reference link 236

Update method 72

using directive 251

utility function 212

V

value types 124, 127-129

variables

declaring 48

defining 28

example 28

names 29

naming 57, 58

placeholders 29-32

reference link 28

variable scope 58

class scope 59

global scope 58

local scope 59

variable visibility 59

vectors 185-187

reference link 186

Visual Studio editor 16

C# file, opening 16, 17

naming mismatches, of C# file 17, 18

W

while loops 109-112

white-boxing 155

drywall, creating 158, 159

editor tools 156-158

health pickup, creating 164, 165

hierarchy, cleaning 159, 160

Prefabs, working with 161-164

World space 160

X

XML (Extensible Markup Language) 336-338

deserializing 367-369

reference link 336

serializing 364-366

XMLWriter

creating 359-362

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below
https://packt.link/free-ebook/9781837636877
  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.188.64