CS0030 Cannot convert type 'UnityEngine,Networking.PlayerController' to 'PlayerController'
Trying to convert my singleplayer game to a mutiplayer version that has a lobby system using this https://www.assetstore.unity3d.com/en/#!/content/41836
and this particular line of code has an issue that I don't know how to fix:
int localPlayerCount = 0;
foreach (PlayerController p in ClientScene.localPlayers)
localPlayerCount += (p == null || p.playerControllerId = -1) ? 0 : 1;
the problem is in the foreach line which says that it cannot convert type UnityEngine.Networking.PlayerController to PlayerController
My PlayerController Script is extending from another Class which has a NetworkBehaviour instead of a Monobehaviour so that should be fine?
public class PlayerController : LivingEntity
In LivingEntity:
public class LivingEntity : NetworkBehaviour, IDamageable//(interface)
So what is the problem here? Unity doesn't allow me to continue if this script isn't fixed :/
Answer by JedBeryll · May 29, 2016 at 05:34 AM
Well that's a completely different script with the same name from what i understand.
foreach (UnityEngine.Networking.PlayerController p in ClientScene.localPlayers)
i think this should work
Your answer
Follow this Question
Related Questions
CS0030 Cannot convert type 'UnityEngine,Networking.PlayerController' to 'PlayerController' 0 Answers
Simple Question: Is the Unity 5.4+ "NetworkLobbyManager" bugged? 0 Answers
Modifying Unity Network Lobby 0 Answers
[Multiplayer Lobby] NetworkManager has a NetworkIdentity component 1 Answer
A lobby room where multiple player can compete with each other 0 Answers