Quantcast
Channel: Latest Questions by Kenshen112
Viewing all articles
Browse latest Browse all 16

Unity freeze

$
0
0
Hey so I'm trying to program a special power into my game i like to call the spirit meter The first basic function of this meter allows players to see invisible objects Spirit Meter using UnityEngine; using System.Collections; public class SpiritMeter : MonoBehaviour { public static float spirit = 10.0f; GUIText SpiritGUI; // Update is called once per frame void Update () { guiText.text = spirit.ToString(); } } Invisible using UnityEngine; using System.Collections; public class Invisible : MonoBehaviour { public static bool invisible; // Update is called once per frame void Update () { invisible = true; if (invisible == true) { renderer.enabled = false; } if (invisible == false) { renderer.enabled = true; } } } Power1 using UnityEngine; using System.Collections; public class Power1 : MonoBehaviour { // Update is called once per frame void Update () { if (Input.GetKeyDown(KeyCode.G)){ while (SpiritMeter.spirit == 10.0f){ Invisible.invisible = false; } } } } When ever I press the set key of G unity as a whole freezes and I have to restart unity what's wrong?

Viewing all articles
Browse latest Browse all 16

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>