Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Unity 2021 Cookbook
Unity 2021 Cookbook

Unity 2021 Cookbook: Over 140 recipes to take your Unity game development skills to the next level , Fourth Edition

Arrow left icon
Profile Icon Shaun Ferns Profile Icon Matt Smith Profile Icon Shaun Ferns
Arrow right icon
$54.99
Paperback Sep 2021 816 pages 4th Edition
eBook
$29.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Shaun Ferns Profile Icon Matt Smith Profile Icon Shaun Ferns
Arrow right icon
$54.99
Paperback Sep 2021 816 pages 4th Edition
eBook
$29.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$29.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Unity 2021 Cookbook

Responding to User Events for Interactive UIs

Almost all the recipes in this chapter involve different interactive UI controls. Although there are different kinds of interactive UI controls, the basic way to work with them, as well as to have scripted actions respond to user actions, is all based on the same idea: events triggering the execution of object method functions.

Then, for fun, and as an example of a very different kind of UI, the final recipe will demonstrate how to add sophisticated, real-time communication for the relative positions of objects in the scene to your game (that is, radar!).

The UI can be used for three main purposes:

  • To display static (unchanging) values, such as the name or logo image of the game, or word labels such as Level and Score, that tell us what the numbers next to them indicate (the recipes for these can be found in Chapter 1Displaying Data with Core UI Elements).
  • To display values that change due to our scripts, such as timers, scores, or the distance from our Player character to some other object (an example of this is the radar recipe at the end of this chapter, Displaying a radar to indicate the relative locations of objects).
  • Interactive UI controls, whose purpose is to allow the player to communicate with the game scripts via their mouse or touchscreen. These are the ones we'll look at in detail in this chapter.

The core concept of working with Unity interactive UI controls is to register an object's public method so that we're informed when a particular event occurs. For example, we can add a UI dropdown to a scene named DropDown1, and then write a MyScript script class containing a NewValueAction() public method to perform an action. However, nothing will happen until we do two things:

  • We need to add an instance of the script class as a component of a GameObject in the scene (which we'll name go1 for our example  although we can also add the script instance to the UI GameObject itself if we wish to).
  • In the UI dropdown's properties, we need to register the GameObject's public method of its script component so that it responds to the On Value Changed event messages:
Figure 2.1 – Graphical representation of the UI at design time

The NewValueAction() public method of the MyScript script will typically retrieve the value that's been selected by the user in the dropdown and do something with it  for example, confirm it to the user, change the music volume, or change the game's difficulty. The NewValueAction() method will be invoked (executed) each time the go1 GameObject receives the NewValueAction() message. In the properties of DropDown1, we need to register go1's scripted component – that is, MyScript's NewValueAction() public method  as an event listener for On Value Changed events. We need to do all this at design time (that is, in the Unity Editor before running the scene):

Figure 2.2 – Graphical representation of the runtime of the UI

At runtime (when the scene in the application is running), we must do the following:

  1. If the user changes the value in the drop-down menu of the DropDown1 GameObject (step 1 in the preceding diagram), this will generate an On Value Changed event.
  2. DropDown1 will update its display on the screen to show the user the newly-selected value (step 2a). It will also send messages to all the GameObject components registered as listeners to On Value Changed events (step 2b).
  3. In our example, this will lead to the NewValueAction() method in the go1 GameObject's scripted component being executed (step 3).

Registering public object methods is a very common way to handle events such as user interaction or web communications, which may occur in different orders, may never occur, or may happen several times in a short period. Several software design patterns describe ways to work with these event setups, such as the Observer pattern and the Publisher-Subscriber design pattern.

Core GameObjects, components, and concepts related to interactive Unity UI development include the following:

  • Visual UI controls: The visible UI controls themselves include Button, Image, Text, and Toggle. These are the UI controls the user sees on the screen and uses their mouse/touchscreen to interact with. These are the GameObjects that maintain a list of object methods that have subscribed to user-interaction events.

  • Interaction UI controls: These are non-visible components that are added to GameObjects; examples include Input Field and Toggle Group.
  • Panel: UI objects can be grouped together (logically and physically) with UI Panels. Panels can play several roles, including providing a GameObject parent in the Hierarchy window for a related group of controls. They can provide a visual background image to graphically relate controls on the screen, and they can also have scripted resize and drag interactions added if desired.
  • Sibling Depth: The bottom-to-top display order (what appears on the top of what) for a UI element is determined initially by its place in the sequence in the Hierarchy window. At design time, this can be manually set by dragging GameObjects into the desired sequence in the Hierarchy window. At runtime, we can send messages to the Rect Transforms of GameObjects to dynamically change their Hierarchy position (and therefore, the display order) as the game or user interaction demands. This is illustrated in the Organizing images inside panels and changing panel depths via buttons recipe.

Often, a UI element exists with most of the components that you may need for something in your game, but you may need to adapt it somehow. An example of this can be seen in the Displaying a countdown timer graphically with a UI Slider recipe, which makes a UI Slider non-interactive, instead of using it to display a red-green progress bar for the status of a countdown timer.

In this chapter, we will cover the following recipes:

  • Creating UI Buttons to move between scenes
  • Animating UI Button properties on mouseover
  • Organizing image panels and changing panel depths via UI Buttons
  • Displaying the value of an interactive UI Slider
  • Displaying a countdown timer graphically with a UI Slider
  • Setting custom mouse cursors for 2D and 3D GameObjects
  • Setting custom mouse cursors for UI controls
  • Interactive text entry with Input Field
  • Toggles and radio buttons via toggle groups
  • Creating text and image icon UI Drop-down menus
  • Displaying a radar to indicate the relative locations of objects

Technical requirements

For this chapter, you will need Unity 2021.1 or later, plus one of the following:

  • Microsoft Windows 10 (64-bit)/GPU: DX10, DX11, and DX12-capable
  • macOS Sierra 10.12.6+/GPU Metal-capable Intel or AMD
  • Linux Ubuntu 16.04, Ubuntu 18.04, and CentOS 7/GPU: OpenGL 3.2+ or Vulkan-capable, NVIDIA or AMD

For each chapter, there is a folder that contains the asset files you will need in this book's GitHub repository at https://github.com/PacktPublishing/Unity-2021-Cookbook-Fourth-Edition.

Creating UI Buttons to move between scenes

The majority of games include a menu screen that displays messages to the user about instructions, high scores, the level they have reached so far, and so on. Unity provides UI Buttons to offer users a simple way to indicate their choices:

Figure 2.3 – Example of a Main Menu UI Button

In this recipe, we'll create a very simple game consisting of two screens, each with a button to load the other one, as illustrated in the preceding screenshot.

How to do it...

To create a button-navigable multi-scene game, follow these steps:

  1. Create a new Unity 2D project.
  2. Save the current (empty) scene in a new folder called _Scenes, naming the scene page1
  3. Add a UI Text object positioned at the top center of the scene containing large white text that says Main Menu (page 1).
  1. Add a UI Button to the scene positioned in the middle-center of the screen. In the Hierarchy window, click on the show children triangle to display the Text child of this GameObject button. Select the Text GameObject and, in the Inspector window for the Text property of the Text (Script) component, enter the text goto page 2:
Figure 2.4 – UI Button Text child
  1. Create a second scene, named page2, with UI Text = Instructions (page 2) and a UI Button with the goto page 1 text. You can either repeat the preceding steps or you can duplicate the page1 scene file, naming the duplicate page2, and then edit the UI Text and UI Button Text appropriately.
  2. Add both scenes to the build, which is the set of scenes that will end up in the actual application built by Unity. To add scene1 to the build, open the page1 scene and go to File | Build Settings.... Then, click on the Add Open Scenes button so that the page1 scene becomes the first scene in the list of Scenes in the build. Now open page2 and repeat this process so that both scenes have been added to the build.
We cannot tell Unity to load a scene that has not been added to the list of scenes in the build. This makes sense since when an application is built, we should never try to open a scene that isn't included as part of that application.
  1. Ensure you have the page1 scene open.
  2. Create a C# script class called SceneLoader, in a new folder called _Scripts that contains the following code. Then, add an instance of the SceneLoader as a scripted component to Main Camera:
using UnityEngine; 
using UnityEngine.SceneManagement; 

public class SceneLoader : MonoBehaviour { 
    public void LoadOnClick(int sceneIndex) { 
        SceneManager.LoadScene(sceneIndex); 
    } 
} 
  1. Select Button in the Hierarchy window and click on the plus (+) button at the bottom of the Button (Script) component, in the Inspector window, to create a new OnClick event handler for this button (that is, an action to perform when the button is clicked).
  2. Drag Main Camera from the Hierarchy window over the Object slot immediately below the menu that says Runtime Only. This means that when the button receives an OnClick event, we can call a public method from a scripted object inside Main Camera.
  1. Select the LoadOnClick method from the SceneLoader drop-down list (initially showing No Function). Type 1 (the index of the scene we want to be loaded when this button is clicked) in the text box, below the method's drop-down menu. This integer, 1, will be passed to the method when the button receives an OnClick event message, as shown here:
Figure 2.5 – Button (Script) settings
  1. Save the current scene (page1).
  2. Open page2 and follow the same steps to make the page2 button load page1. That is, add an instance of the  SceneLoader script class to Main Camera and then add an OnClick event action to the button that calls LoadOnClick and passes an integer of 0 so that page1 is loaded.
  3. Save page2.
  4. When you run the page1 scene, you will be presented with your Main Menu text and a button that, when clicked, makes the game load the page2 scene. On page2, you'll have a button to take you back to page1.
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Discover the latest features of Unity 2021 including coverage of AR/VR development
  • Follow practical recipes for better 2D and 2D character development with Unity GameKits
  • Learn powerful techniques and expert best practices in building 3D objects, textures, and materials

Description

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. With this cookbook, you’ll work through a wide variety of recipes that will help you use the essential features of the Unity game engine to their fullest potential. You familiarize yourself with shaders and Shader Graph before exploring animation features to enhance your skills in building games. As you progress, you will gain insights into Unity's latest editor, which will help you in laying out scenes, tweaking existing apps, and building custom tools for augmented reality and virtual reality (AR/VR) experiences. The book will also guide you through many Unity C# gameplay scripting techniques, teaching you how to communicate with database-driven websites and process XML and JSON data files. By the end of this Unity book, you will have gained a comprehensive understanding of Unity game development and built your development skills. The easy-to-follow recipes will earn a permanent place on your bookshelf for reference and help you build better games that stay true to your vision.

Who is this book for?

If you’re a Unity developer looking for better ways to resolve common recurring problems with recipes, then this book is for you. Programmers dipping their toes into multimedia features for the first time will also find this book useful. Before you get started with this Unity engine book, you’ll need a solid understanding of Unity’s functionality and experience with programming in C#.

What you will learn

  • Discover how to add core game features to your projects with C# scripting
  • Create powerful and stylish UI with Unity's UI system, including power bars, radars, and button-driven scene changes
  • Work with essential audio features, including background music and sound effects
  • Discover Cinemachine in Unity to intelligently control camera movements
  • Add visual effects such as smoke and explosions by creating and customizing particle systems
  • Understand how to build your own Shaders with the Shader Graph tool
Estimated delivery fee Deliver to Colombia

Standard delivery 10 - 13 business days

$19.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 06, 2021
Length: 816 pages
Edition : 4th
Language : English
ISBN-13 : 9781839217616
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Estimated delivery fee Deliver to Colombia

Standard delivery 10 - 13 business days

$19.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

Product Details

Publication date : Sep 06, 2021
Length: 816 pages
Edition : 4th
Language : English
ISBN-13 : 9781839217616
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 161.97
Unity 2021 Cookbook
$54.99
Learning C# by Developing Games with Unity 2021
$62.99
Hands-On Unity 2021 Game Development
$43.99
Total $ 161.97 Stars icon

Table of Contents

15 Chapters
Displaying Data with Core UI Elements Chevron down icon Chevron up icon
Responding to User Events for Interactive UIs Chevron down icon Chevron up icon
Inventory and Advanced UIs Chevron down icon Chevron up icon
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
Playing and Manipulating Sounds Chevron down icon Chevron up icon
Creating 3D Objects, Terrains, Textures, and Materials Chevron down icon Chevron up icon
2D Animation and Physics Chevron down icon Chevron up icon
Characters, Game Kits, and Starter Assets Chevron down icon Chevron up icon
Web Server Communication and Online Version Control Chevron down icon Chevron up icon
Controlling and Choosing Positions Chevron down icon Chevron up icon
Navigation Meshes and Agents Chevron down icon Chevron up icon
Cameras and Rendering Pipelines Chevron down icon Chevron up icon
Shader Graphs and Video Players Chevron down icon Chevron up icon
Advanced Topics - Gizmos, Automated Testing, and More Chevron down icon Chevron up icon
Advanced Topics - Gizmos, Automated Testing, and More
Technical requirements
Using Gizmo to show the currently selected object in the Scene window
How to do it...
How it works...
See also
Creating an editor snap-to-grid drawn by a Gizmo
How to do it...
How it works...
There's more...
Saving and loading player data – using static properties
Getting ready
How to do it...
How it works...
There's more...
Hiding the score before the first attempt is completed
See also
Saving and loading player data – using PlayerPrefs
Getting ready
How to do it...
How it works...
See also
Loading game data from a text file map
Getting ready
How to do it...
How it works...
Saving data to a file while the game is running
How to do it...
How it works...
See also
Generating and running a default test script class
How to do it...
How it works...
There's more...
Creating a default test script from the Project window's Create menu
Edit mode minimum skeleton unit test script
A simple unit test
How to do it...
How it works...
There's more...
Shorter tests with values in the assertion
Expected value followed by the actual value
Parameterizing tests with a data provider
How to do it...
How it works...
Unit testing a simple health script class
How to do it...
How it works...
Health.cs
TestHealth.cs
Creating and executing a unit test in PlayMode
How to do it...
How it works...
PlayMode testing a door animation
Getting ready
How to do it...
How it works...
There's more...
PlayMode and unit testing a player health bar with events, logging, and exceptions
Getting ready
How to do it...
How it works...
PlayMode testing
Unit tests
See also
Reporting Code Coverage testing
Getting ready
How to do it...
How it works...
Running simple Python scripts inside Unity
How to do it...
How it works...
Further reading
Particle Systems and Other Visual Effects Chevron down icon Chevron up icon
Virtual and Augmented Reality (VR/AR) Chevron down icon Chevron up icon
Virtual and Augmented Reality (VR/AR)
Technical requirements
Setting up Unity for VR
How to do it...
How it works...
Setting up an Oculus Quest/2 in Developer Mode
Getting ready
How to do it...
How it works...
Creating a VR project for the Oculus Quest/2
Getting ready
How to do it...
How it works...
There's more...
Build failure due to Android version
Build failure due to "namespace cannot be found" error
Sideloading APK files to an Android device (such as the Quest headset)
Creating a VR project using the Mock HMD device
Getting ready
How to do it...
How it works...
Working with the Mozilla demo WebXR project
Getting ready
How to do it...
How it works...
There's more...
Using GitHub Pages to publish your WebXR project for free
Learning more about the WebXR example project
Fixing pink (shader/material) problems
The community maintaining more up-to-date XR resources
Fixing obsolete code errors
Adding 360-degree videos to a VR project
Getting ready
How to do it...
How it works...
There's more...
Playing 360-degree videos on the surface of a 3D object
Exploring the Unity AR samples
Getting ready
How to do it...
How it works...
There's more...
Targeting iOS device builds
Allowing Android APK file downloads on your phone
Setting up Unity for AR
How to do it...
How it works...
There's more...
Build failure due to Android version
Build failure due to Vulkan API graphics settings
Creating a simple AR Foundation project
Getting ready
How to do it...
How it works...
Detecting and highlighting planes with AR Foundation
Getting ready
How to do it...
How it works...
Creating an AR furniture previewer by detecting horizontal planes
Getting ready
How to do it...
How it works...
Creating a floating 3D model over an image target
Getting ready
How to do it...
How it works...
Further reading
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela