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! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Unity 2018 Cookbook

You're reading from   Unity 2018 Cookbook Over 160 recipes to take your 2D and 3D game development to the next level

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher
ISBN-13 9781788471909
Length 794 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Francisco Queiroz Francisco Queiroz
Author Profile Icon Francisco Queiroz
Francisco Queiroz
Matt Smith Matt Smith
Author Profile Icon Matt Smith
Matt Smith
Arrow right icon
View More author details
Toc

Table of Contents (29) Chapters Close

Title Page
Copyright and Credits
Dedication
Packt Upsell
Foreword
Contributors
Preface
1. Displaying Data with Core UI Elements FREE CHAPTER 2. Responding to User Events for Interactive UIs 3. Inventory UIs 4. Playing and Manipulating Sounds 5. Creating Textures, Maps, and Materials 6. Shader Graphs and Video Players 7. Using Cameras 8. Lights and Effects 9. 2D Animation 10. 3D Animation 11. Webserver Communication and Online Version-Control 12. Controlling and Choosing Positions 13. Navigation Meshes and Agents 14. Design Patterns 15. Editor Extensions and Immediate Mode GUI (IMGUI) 16. Working with External Resource Files and Devices 17. Working with Plain Text, XML, and JSON Text Files 18. Virtual Reality and Extra Features 19. Automated Testing 1. Bonus Chapters 2. Other Books You May Enjoy Index

Unity game communication with web-server leaderboard


In this recipe, we create a Unity game Client that can communicate, via UI buttons, with our web server leaderboard from the previous recipe:

Getting ready

Since the scene contains several UI elements and the code of the recipe is the communication with the PHP scripts and SQL database, in the 12_02 folder, we have provided a Unity package called UnityLeaderboardClient, containing a scene with everything set up for the Unity project.

How to do it...

To create a Unity game that communicates with the web-server leaderboard, do the following:

  1. Import the provided Unity package, UnityLeaderboardClient.
  2. Run the provided Scene.
  3. Ensure your PHP leaderboard is up and running.
  1. If you are not running locally (localhost:8000), you'll need to update the URL by selecting the Main Camera in the Hierarchy, and then editing the Leader Board URL text for the Web Leaderboard (Script) component in the Inspector:
  1. Click on the UIButtons to make Unity communicate with...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Banner background image