Answer the question
In order to leave comments, you need to log in
Error Unity.2019.2.13f1? Randomizer?
I can't figure it out, here are the problems with the unit
Assets\Scripts\LuckyGame.cs(36,16): error CS0104: 'Random' is an ambiguous reference between 'UnityEngine.Random' and 'System.Random'
And the code is here
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
using System;
using UnityEngine.Monetization;
using UnityEngine.SceneManagement;
public class LuckyGame : MonoBehaviour
{
public int price;
private int Rate;
public Text priceText;
public Text rateText;
public void StartGame()
{
if(Main.money > Rate)
{
StartCoroutine(LuckGame());
}
}
void Update()
{
priceText.text = price + "";
rateText.text = Rate + "";
}
IEnumerator LuckGame()
{
price = Random.Range(0, 11);
Main.money += price;
yield return new WaitForSeconds(0.5f);
price = 0;
}
public void RatePlus()
{
Rate += 1;
}
public void RateMinus()
{
Rate -= 1;
}
}
Answer the question
In order to leave comments, you need to log in
It's time to learn seasharp and learn to read errors, and not mindlessly copy-paste the code.
There are two Random classes. One is in UnityEngine, the second is in System. You need to specify EXACTLY which one to use. Either using, or add a namespace right at the place of use.
Sobsno the error also speaks about it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question