My C# script crashes Unity and I don't know why, help?
All it does is make a public float, but when I put it into a game object, the whole editor crashes.
Here's the script:
using UnityEngine; using System.Collections;
public class Nope : MonoBehaviour { public float night; // Use this for initialization void Start () {
}
// Update is called once per frame
void Update () {
}
}
Hi, first of all please make sure your code is formatted properly before posting the question.
using UnityEngine;
using System.Collections;
public class Nope : $$anonymous$$onoBehaviour {
public float night;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
This should not crash Unity. Like you said all it does is declare a float.
Which Unity version are you using?
Is your class name the same as the file's name? I mean is the file called "Nope.cs"?
Have you made a new script and tried the same?
Have a nice day.
I know, I restored the studio to a previous version, I am using Unity 5 still, the most recent one, (I like to stay updated on Unity 3D) but it seems to have fixed the problem. Probably just some kinda bug in Unity, thank you for taking the time to answer though.
I hope you have a nice day also.
Your answer
![](https://koobas.hobune.stream/wayback/20220612050135im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can I check if a object in the hierarchy have been destroyed using EditorWindow type script ? 1 Answer
Hey guys I need help for a score broad system. 2 Answers
I have this movement script that works just fine, but how do i integrate jumping and running? 0 Answers
Change public variable with button 1 Answer
The laser problems 0 Answers