"Can't convert type float to string"

Hi, I am trying to make a simple game, but it keeps giving me this error:
Assets\Scripts\NextLevel.cs(22,32): error CS1503: Argument 1: cannot convert from ‘float’ to ‘string’

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class NextLevel : MonoBehaviour
{

private float level = 0f;

void OnTriggerEnter(Collider other)
{
    if (other.CompareTag("Player"))
    {
        ChangeLevel();
    }
}

void ChangeLevel()
{
    level += 1f;

    SceneManager.LoadScene(level);
}

}

Based on the manual, maybe change your variable ‘level’ from float to int can help.

You can try SceneManager.LoadScene(level.ToString()); , but as TomisTony mentioned, you are probably better off changing ‘level’ to an int, as you don’t need to deal with any fractional numbers in your level manager.

float a = 0;
string b = “” + (a += 1.0f);
Gives no errors :slight_smile: