Need help with code. Issue CS0131,Having troubles cs0131
I am making a little code for a randomizer and need help. I have worked it out so far but it keeps showing errors. Hopefully someone can help!
Error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer (CS0131)
Error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer (CS0131)
CODE:
using UnityEngine;
using UnityEngine.SceneManagement;
public class Market1 : MonoBehaviour {
// Use this for initialization
void Start ()
{
SceneManager.LoadScene(Random.Range(0, SceneManager.sceneCount));
int Rone = Random.Range (
int.MinValue = 1,
int.MaxValue = 21);
}
}
THANKS FOR ANY HELP
Answer by ItzChris92 · May 19, 2017 at 08:00 PM
Change int Rone, to int rone. Variables need a lower case letter
Answer by Jawchewa · May 20, 2017 at 02:59 AM
The issue is that you don't have to call int.MaxValue or MinValue like that when passing in the arguments into Random.Range. You just need to give it the arguments themselves. Try replacing your random line with this:
int Rone = Random.Range(1, 21);
Your answer
![](https://koobas.hobune.stream/wayback/20220612122334im_/https://answers.unity.com/themes/thub/images/avi.jpg)