Unity 2021 cookbook over 140 recipes to take your Unity game development skills to the next level
If you are a Unity developer looking to explore the newest features of Unity 2021 and recipes for advanced challenges, then this fourth edition of Unity Cookbook is here to help you.
Otros Autores: | , , |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham :
Packt Publishing
2021.
|
Edición: | 4th ed |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009644301606719 |
Tabla de Contenidos:
- Intro
- Title Page
- Copyright and Credits
- Dedication
- Foreword
- Contributors
- Table of Contents
- Preface
- Chapter 1: Displaying Data with Core UI Elements
- Technical requirements
- Displaying a "Hello World" UI text message
- Getting ready
- How to do it...
- How it works...
- There's more...
- Styling substrings with rich text
- Displaying a digital clock
- Getting ready
- How to do it...
- How it works...
- Displaying a digital countdown timer
- Getting ready
- How to do it...
- How it works...
- Creating a message that fades away
- Getting ready
- How to do it...
- How it works...
- Displaying a perspective 3D Text Mesh
- Getting ready
- How to do it...
- How it works...
- There's more...
- Making the text crawl as it does in the movie
- Where to learn more
- Creating sophisticated text with TextMeshPro
- Getting ready
- How to do it...
- How it works...
- There's more...
- Rich text substrings for colors, effects, and sprites
- Displaying an image
- Getting ready
- How to do it...
- How it works...
- There's more...
- Working with 2D sprites and UI Image components
- See also
- Creating UIs with the Fungus open source dialog system
- How to do it...
- How it works...
- Creating a Fungus character dialog with images
- How to do it...
- How it works...
- There's more...
- Further reading
- Chapter 2: Responding to User Events for Interactive UIs
- Technical requirements
- Creating UI Buttons to move between scenes
- How to do it...
- How it works...
- There's more...
- Animating button properties on mouseover
- How to do it...
- How it works...
- Organizing image panels and changing panel depths via buttons
- Getting ready
- How to do it...
- How it works...
- There's more...
- Moving up or down by just one position, using scripted methods.
- Displaying the value of an interactive UI Slider
- How to do it...
- How it works...
- Displaying a countdown timer graphically with a UI Slider
- Getting ready
- How to do it...
- How it works...
- Setting custom mouse cursors for 2D and 3D GameObjects
- Getting ready
- How to do it...
- How it works...
- Setting custom mouse cursors for UI controls
- Getting ready
- How to do it...
- How it works...
- Interactive text entry with Input Field
- How to do it...
- How it works...
- There's more...
- Toggles and radio buttons via toggle groups
- Getting ready
- How to do it...
- How it works...
- There's more...
- Creating text and image icon UI Drop-down menus
- Getting ready
- How to do it...
- How it works...
- There's more...
- Adding images to a Dropdown control
- Displaying a radar to indicate the relative locations of objects
- Getting ready
- How to do it...
- How it works...
- The Start() method
- The Update() method
- The FindAndDisplayBlipsForTag(...) method
- The CalculateBlipPositionAndDrawBlip (...) method
- The NormalizedPosition(...) method
- The CalculateBlipPosition(...) method
- The DrawBlip() method
- There's more...
- Chapter 3: Inventory and Advanced UIs
- Technical requirements
- Creating a simple 2D mini-game - SpaceGirl
- Getting ready
- How to do it...
- How it works...
- Displaying single object pickups with carrying and not-carrying text
- Getting ready
- How to do it...
- How it works...
- The PlayerInventory script class
- The PlayerInventoryDisplay script class
- There's more...
- Collecting multiple items and display the total number carried
- Alternative - combining all the responsibilities into a single script
- Displaying single-object pickups with carrying and not-carrying icons
- Getting ready
- How to do it...
- How it works.
- Displaying multiple pickups of the same object with multiple status icons
- Getting ready
- How to do it...
- How it works...
- There's more...
- Revealing icons for multiple object pickups by changing the size of a tiled image
- Using panels to visually outline the inventory UI area and individual items
- Getting ready
- How to do it...
- How it works...
- Creating a C# inventory slot UI to display scripted components
- Getting ready
- How to do it...
- How it works...
- There's more...
- Modifying the game for a second inventory panel for keys
- Using UI Grid Layout Groups to automatically populate a panel
- Getting ready
- How to do it...
- How it works...
- There's more...
- Automatically inferring the number of inventory slots based on the number of GameObjects tagged Star
- Adding a horizontal scroll bar to the inventory slot display
- Automatically changing the grid cell size based on the number of slots in the inventory
- Displaying multiple pickups of different objects as a list of text via a dynamic list of scripted PickUp objects
- Getting ready
- How to do it...
- How it works...
- There's more...
- Ordering items in the inventory list alphabetically
- Using a Dictionary and Enums to display text totals for different objects
- Getting ready
- How to do it...
- How it works...
- Creating a runtime UI Toolkit interface
- Getting ready
- How to do it...
- How it works...
- Further reading
- Chapter 4: Playing and Manipulating Sounds
- Technical requirements
- Playing different one-off sound effects with a single AudioSource component
- Getting ready
- How to do it...
- How it works...
- There's more...
- Playing a sound at a static point in 3D world space
- Playing and controlling different sounds each with its own AudioSource component
- Getting ready
- How to do it...
- How it works.
- Creating just-in-time AudioSource components at runtime through C# scripting
- Getting ready
- How to do it...
- How it works...
- There's more...
- Adding the CreateAudioSource(...) method as an extension to the MonoBehavior class
- Delaying before playing a sound
- Getting ready
- How to do it...
- How it works...
- Preventing an audio clip from restarting if it is already playing
- Getting ready
- How to do it...
- How it works...
- Waiting for the audio to finish playing before auto-destructing an object
- Getting ready
- How to do it...
- How it works...
- See also
- Scheduling a sound to play at a certain time
- Getting ready
- How to do it...
- How it works...
- Audio visualization from sample spectral data
- Getting ready
- How to do it...
- How it works...
- There's more...
- Adding visualizations to a second AudioSource component
- Trying out different Fast Fourier Transform (FFT) window types
- Synchronizing simultaneous and sequential music to create a simple 140 bpm music-loop manager
- Getting ready
- How to do it...
- How it works...
- There's more...
- Adding visualizations to the four playing loops
- Further reading
- Chapter 5: Creating 3D Objects, Terrains, Textures, and Materials
- Technical requirements
- Creating 3D primitives and adding materials and textures
- Getting ready
- How to do it...
- How it works...
- There's more...
- Enhancing the scene - adding a spotlight and wood material
- Creating a new Material asset file in the Project window and then setting its Albedo to a texture
- Converting and importing 3D models into a project
- Getting ready
- How to do it...
- How it works...
- Highlighting GameObject materials on mouseover
- Getting ready
- How to do it...
- How it works...
- There's more...
- Collider needed for custom meshes.
- Changing the material's color in response to mouse events
- Fading the transparency of a material
- How to do it...
- How it works...
- There's more...
- Destroying objects when fading is complete
- Using the GameObject's alpha as our starting alpha value
- Using a coroutine for our fading loop
- Creating geometry with ProBuilder
- How to do it...
- How it works...
- Creating a house with ProBuilder
- How to do it...
- How it works...
- Creating and texture-painting terrains
- How to do it...
- How it works...
- Height painting terrains
- Getting ready
- How to do it...
- How it works...
- Adding Terrain holes
- Getting ready
- How to do it...
- How it works...
- There's more...
- Further reading
- Chapter 6: 2D Animation and Physics
- Technical requirements
- Flipping a sprite horizontally - the DIY approach
- Getting ready
- How to do it...
- How it works...
- There's more...
- Flipping a sprite horizontally - using Animator State Chart and transitions
- Getting ready
- How to do it...
- How it works...
- There's more...
- Instantaneous swapping
- Animating body parts for character movement events
- Getting ready
- How to do it...
- How it works...
- Creating a three-frame animation clip to make a platform continually animate
- Getting ready
- How to do it...
- How it works...
- There's more...
- Copying the animation relative to a new parent GameObject
- Making a platform start falling once stepped on using a Trigger to move the animation from one state to another
- Getting ready
- How to do it...
- How it works...
- Creating animation clips from sprite sheet sequences
- Getting ready
- How to do it...
- How it works...
- Creating a platform game with tiles and tilemaps
- Getting ready
- How to do it...
- How it works...
- There's more...
- Tile palettes for objects and walls.
- Using sprite placeholders to create a simple physics scene.