Hey everyone! I'm learning so bear with me. I wanted to add some functionality to the PlayerSpawner.cs in the FPSLand clients folder so I made a new script and inherited from it. Now when I load the game my character is no longer spawning and the cameras not being setup how it used to in FPSLand 😦
Any ideas what I did wrong here? or if there is a better way to add onto PlayerSpawner.cs -- I'm trying to keep everything separated so its easy for me to update FPSLand later on. Here is the script
using FishNet.Object;
using UnityEngine;
public class PlayerSpawner : FirstGearGames.FPSLand.Clients.PlayerSpawner
{
/// <summary>
/// Sets up SpawnedCharacterData using a gameObject.
/// </summary>
/// <param name="go"></param>
protected override void SetupSpawnedCharacterData(GameObject go)
{
SpawnedCharacterData.NetworkObject = go.GetComponent<NetworkObject>();
SpawnedCharacterData.Health = go.GetComponent<Health>();
SpawnedCharacterData.PlayerName = "default";
}
[ServerRpc(RunLocally = true)]
public void RpcUpdatePlayerName(string name)
{
Debug.Log(SpawnedCharacterData.PlayerName + " has changed their name to " + name);
SpawnedCharacterData.PlayerName = name;
}
}```
The only thing I changed in the original PlayerSpawner.cs is the SetupSpawnedCharacterData method, I changed the type from private to protected so I could override. The original PlayerSpawner.cs still work with this modification though, only thing that doesn't is the new PlayerSpawner
```protected virtual void SetupSpawnedCharacterData(GameObject go)
{
SpawnedCharacterData.NetworkObject = go.GetComponent<NetworkObject>();
SpawnedCharacterData.Health = go.GetComponent<Health>();
}```
Thanks in advance!