In editor is working fine, but after i build the game files and i buy a weapon, my game just crashes, why is happen that?, in console i don’t get any error.
EDIT: When i am in Weapon Shop, Time.timeScale = 0.
WeaponShop code:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using CodeStage.AntiCheat.ObscuredTypes;
using UnityEngine.SceneManagement;
public class WeaponShop : MonoBehaviour
{
[Header("-Weapon Settings 01-")]
public Button WeaponButton1;
public ObscuredInt WeaponPrice1 = 5000;
public ObscuredInt WeaponPriceInsane1 = 1500;
public ObscuredInt LevelForWeapon1 = 5;
public Text weaponPriceText1;
public GameObject blockedPannel;
public Text levelTextPermison;
[Header("-Weapons Boolen Options-")]
public ObscuredBool weaponPsitol = true;
public ObscuredBool weaponAssaultRifle = false;
SwichWeapons wp1;
private ObscuredString InsaneSceneName = "InsaneWaveInferno";
void Start()
{
WeaponButton1.interactable = false;
weaponPsitol = true;
weaponAssaultRifle = false;
weaponPriceText1.text = WeaponPrice1 + "$";
SwichWeapons changeWeapon = FindObjectOfType(typeof(SwichWeapons)) as SwichWeapons;
changeWeapon.DefaultWeaponVoid();
Scene currentScene = SceneManager.GetActiveScene();
string sceneName = currentScene.name;
if (sceneName == InsaneSceneName)
{
WeaponPrice1 = WeaponPriceInsane1;
}
}
void Update()
{
if (UpgradeMenu.Money >= WeaponPrice1)
{
if (weaponAssaultRifle == false && weaponPsitol == true)
{
WeaponButton1.interactable = true;
}
else if (weaponAssaultRifle == true && weaponPsitol == false)
{
WeaponButton1.interactable = false;
}
}
else
{
WeaponButton1.interactable = false;
}
if (LevelSystem.PlayerLevel < LevelForWeapon1)
{
blockedPannel.SetActive(true);
levelTextPermison.text = "You don't have level " + LevelForWeapon1;
WeaponButton1.interactable = false;
}
else if (LevelSystem.PlayerLevel >= LevelForWeapon1)
{
blockedPannel.SetActive(false);
}
if (weaponPsitol == true && weaponAssaultRifle == false)
{
SwichWeapons changeWeapon = FindObjectOfType(typeof(SwichWeapons)) as SwichWeapons;
if (changeWeapon != null)
{
changeWeapon.DefaultWeaponVoid();
}
weaponPriceText1.text = WeaponPrice1 + "$";
}
if (weaponAssaultRifle == true && weaponPsitol == false)
{
SwichWeapons changeWeapon = FindObjectOfType(typeof(SwichWeapons)) as SwichWeapons;
if (changeWeapon != null)
{
changeWeapon.weapon01Void();
}
weaponPriceText1.text = "Owned";
}
}
public void BuyWeapon01()
{
if (LevelSystem.PlayerLevel >= LevelForWeapon1)
{
if (UpgradeMenu.Money >= WeaponPrice1)
{
weaponAssaultRifle = true;
weaponPsitol = false;
UpgradeMenu.Money -= WeaponPrice1;
}
}
}
}
SwichWeapons code:
using UnityEngine;
using System.Collections;
public class SwichWeapons : MonoBehaviour
{
public GameObject defaultWeapon;
public GameObject weapon1;
void Start()
{
defaultWeapon.SetActive(true);
weapon1.SetActive(false);
}
public void DefaultWeaponVoid()
{
defaultWeapon.SetActive(true);
weapon1.SetActive(false);
}
public void weapon01Void()
{
defaultWeapon.SetActive(false);
weapon1.SetActive(true);
}
}