public override void OnEvent(SpawnActorEvent evnt) { //Debug.LogWarning("Actor Spawn raised by " + evnt.RaisedBy); if (BoltNetwork.isServer) { ActorObjectRegistry.CreateServerActor().Spawn(evnt.ActorPrefab, (ActorSpawnToken)evnt.ActorSpawnToken); } }
// Actor ID -> which NPC to load from the database. void SpawnActor() { ActorSpawnToken token = new ActorSpawnToken(); token.actorID = actor.GetComponent <ActorNPC>().npcID; token.actorPos = transform.position; var evnt = SpawnActorEvent.Create(); evnt.ActorSpawnToken = token; evnt.ActorPrefab = actor.GetComponent <BoltEntity>().prefabId; Debug.Log("Spawning Actor " + actor.name); evnt.Send(); }