- Home /
This question was
closed Jan 12 at 04:11 PM by
dimbam for the following reason:
I found a fix
Every time I start up the game a certain script gets copied into a Game object
Every time I start up the game a certain script gets copied into a Game object. I can't find anything on the internet and have no idea how to fix it.Idk what to put here so i will just paste the code for the script. CODE:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Database : MonoBehaviour
{
float rng;
float ShootieRarity; //1-common,2-rare,3-epic,4-legendary
private float heroesOwned = 1;
public float Speed=4;
public float strenght=4;
public float stamina;
public float health;
public float WaveNum=0;
public bool AreEnemiesAlive=false;
void Start()
{
//ShootieGeneration();
//Debug.Log(" Speed = " + Speed + " strenght= " + strenght + " stamina= " + stamina + " Healt= " + health + " rarity= " + ShootieRarity);
}
void ShootieGeneration()//generating new hero
{
rng = Random.Range(0, 100);
if (50>=rng){
ShootieRarity = 1;
}else if(90>=rng && rng > 50)
{
ShootieRarity = 2;
}else if(rng>=91 && 100 > rng)
{
ShootieRarity = 3;
}
else
{
ShootieRarity = 4;
}
if (ShootieRarity == 4)
{
Speed = Random.Range(8, 10);
strenght = Random.Range(8, 10);
stamina = Random.Range(8, 10);
health = Random.Range(8, 10);
}else if (ShootieRarity == 3)
{
Speed = Random.Range(6, 8);
strenght = Random.Range(6, 8);
stamina = Random.Range(6, 8);
health = Random.Range(6, 8);
}else if (ShootieRarity == 2)
{
Speed = Random.Range(4, 6);
strenght = Random.Range(4, 6);
stamina = Random.Range(4, 6);
health = Random.Range(4, 6);
}
else
{
Speed = Random.Range(1, 4);
strenght = Random.Range(1, 4);
stamina = Random.Range(1, 4);
health = Random.Range(1, 4);
}
}
// Update is called once per frame
void Update()
{
}
}
![alt text][1]
[1]: /storage/temp/191085-screenshot-2022-01-12-125116.png
screenshot-2022-01-12-125116.png
(23.5 kB)
Comment
Follow this Question
Related Questions
Changing Skybox tint in game, permanently changes it in editor? 1 Answer
Unity instantly crashes when switching from game to scene view. 2 Answers
Can't play Unity games:Automatically moves/turns without any input 0 Answers
Why won't particles prewarm properly in a wind zone? 0 Answers
Android Tab 3 (7 inch) Skybox issue 1 Answer