Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
HoloLens Beginner???s Guide

You're reading from   HoloLens Beginner???s Guide Join the AR revolution with HoloLens

Arrow left icon
Product type Paperback
Published in Apr 2017
Publisher Packt
ISBN-13 9781786464729
Length 376 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Jason M. Odom Jason M. Odom
Author Profile Icon Jason M. Odom
Jason M. Odom
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface Welcome to the New World FREE CHAPTER HoloWorld I am in Control User-Friendly Interface Now That Is How It Should Sound Not So Blank Spaces The Tools of the Trade Share What You Have Got Putting It All Together Fixing Problems

Filling in the blanks


In this section, we will finally make sure that our network code can understand our object by spawning it with network-friendly code. Instead of turning our skee object on or off based on certain conditions, we will spawn it into the game using the PrefabSpawnManager.

The PrefabSpawnManager class takes a Prefab and converts it into data types that can easily be translated across a network. This makes for a far more efficient use of objects:

To begin, click on that Add Component button shown in the preceding screenshot. Scroll down to New Script, type SyncSpawnSkee in the box, make sure that C Sharp is selected, and click on the Create and Add button.

Double-click on the file you have just created, and when it opens, type this short section of code into the editor:

In the SyncSpawnSkeeBallMachine() method, we first create a SyncSpawnedObject called  spawnedObject. We then get the position to spawn the object. In this case, we are using the actual position stored in the Prefab...

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 $19.99/month. Cancel anytime
Banner background image