Networked non-player character

Just like the player character network-enabled prefab, we will use the non-player character prefab as our base to get started. Go ahead and create an instance of your NPC in the scene.

Go ahead and remove the existing NPC_Movement.cs component from the prefab. Rename the Prefab to B1-Network and attach the following components to it: NetworkIdentity, NetworkTransform, and NetworkAnimator, by selecting Add Component | Network | <component name> from the Inspector window.

On the NetworkIdentity component, set Local Player Authority to True; in the NetworkTransform component, set Transform Sync Mode to Sync Transform; and for the NetworkAnimator component, set the Animator slot to the Animator controller attached ...

Get Building an RPG with Unity 2018 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.