Question by
Mythikos · Dec 04, 2016 at 11:05 PM ·
c#networkingstartvariable-definition
String variable declared in editor goes blank at runtime
I am having an issue with my game after doing a pretty big restructuring of my code and I cant seem to figure out whats going on. I have a public variable declared in a class called 'RoundManager' that stores the prefab location of the Player. My editor looks like this:
For whatever reason, when I start the game, the PlayerPrefab exists the first call to Start() but is then blank after that point. My start method looks like this:
[Header("Player Variables")]
public string PlayerPrefab;
IEnumerator Start()
{
// Wait while the player is joining the channel
while (TNManager.isJoiningChannel) yield return null;
if (channelID < 1) channelID = TNManager.lastChannelID;
// Grab available player spawns
_PlayerSpawns = GameObject.FindGameObjectsWithTag("GameObject.PlayerSpawn");
// Set the round manager as initialized
_Initialized = true;
}
Can anyone explain why the PlayerPrefab value, that is set in the editor, decides to default after the first call to Start()? I feel like it might have to do with the networking (I am using TNet 3). Any and all help would be greatly appreciated!
2016-12-04-14-52-49.png
(10.3 kB)
Comment