// ========================================== ROBOT ============================================= public void UpdateRobot() { if (_gameSettings.Robots.Count == 0) { return; // Check for robot prefabs } if (_playerSpawner == null) { return; } // Check for default components depending on robot type GameObject leftComponent = _leftComponentIndex == 0 ? _gameSettings.Robots[_robotIndex].leftComponent.prefab : _gameSettings.Components[_leftComponentIndex - 1].prefab; GameObject rightComponent = _rightComponentIndex == 0 ? _gameSettings.Robots[_robotIndex].rightComponent.prefab : _gameSettings.Components[_rightComponentIndex - 1].prefab; _playerSpawner.Spawn(_gameSettings.Robots[_robotIndex].prefab, leftComponent, rightComponent); _playerSpawner.FreezeSpawned(); _playerSpawner.GetSpawned().GetComponent <HitPoints>().Invincible = true; }