Skip to content

Commit

Permalink
fixed landmine GameObject being null
Browse files Browse the repository at this point in the history
  • Loading branch information
Axyss committed Aug 8, 2024
1 parent 4821bb5 commit b80953a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions LandminePlacer/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,17 @@ private static GameObject TryToGetLandMine()
{
if (_landmine != null)
return _landmine;
var spawnableMapObjects = RoundManager.Instance.spawnableMapObjects;
var spawnableMapObjects = RoundManager.Instance.currentLevel.spawnableMapObjects;
if (spawnableMapObjects.Length == 0)
return null;
RoundManager.Instance.spawnableMapObjects = spawnableMapObjects;

foreach (var spawnableMapObject in spawnableMapObjects)
{
if (spawnableMapObject.prefabToSpawn.GetComponentInChildren<Landmine>() != null)
{
_landmine = spawnableMapObject.prefabToSpawn;
return _landmine;
}
else
{
Log.LogError( $"Could not find default landmine prefab");
return null;
}
}
Log.LogError( $"Could not find default landmine prefab");
return null;
Expand Down

0 comments on commit b80953a

Please sign in to comment.