#FPSLand - Inheriting from PlayerSpawner causes player not to spawn

5 messages · Page 1 of 1 (latest)

static drum
#

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!
#

Also I forgot to add that there are 0 errors in the console.. which is why I'm kindof stuck

#

Just tried ALSO creating a new ClientInstance and inheriting from it, this time I get some errors I havent seen before when trying to play so I'm going to stop tinkering till someone wiser than me can point the way.

{
    #region Public.
    /// <summary>
    /// PlayerSpawner on this object.
    /// </summary>
    public new PlayerSpawner PlayerSpawner { get; private set; }
    #endregion

    public override void OnStartClient()
    {
        base.OnStartClient();
        if (base.IsOwner)
        {
            Instance = this;
            PlayerSpawner = GetComponent<PlayerSpawner>();
            PlayerSpawner.TryRespawn();
        }
    }
}
static drum
#

Its because I had FPSLand in the "Plugins" folder. Solving..

fallen magnet
#

Being in the plugins folder is causing issues?