Unity keeps crashing when I hit play.

Everytime I press play, Unity 5.6.1f1 keeps crashing. I have no idea why it’s doing that at all but it’s annoying me and it’s halting my development. Any feedback, here’s the specs of my computer:
CPU: Intel Core i5-6400
GPU: NVidia GeForce GTX 970 4GB VRAM
RAM: DDR4 8GB

Update, used Visual Studio debugger and found it’s an access violation error that occurring, but that’s all Visual Studio could give me. All disassembly could tell me is where in Address it was occurring.

Have you tried creating a new project and seeing if the issue persists?

I went to other projects and even different scenes, it’s just this one scene Unity seems to have an issue with. Okay, narrowed it down to one of my scripts, but if it’s an error in the script, wouldn’t Unity stop the scene and print an error out. Or is it that while Unity is compiling the script it’s throwing that exception?

If you are able to I would just recommend recreating the scene, unless you know what is causing the problem. Asides from that I dont really know if you can find the source of it.

I just edited my comment, I’ve found it’s one of my scripts but I’m confused on how it’s causing Unity to crash unless Unity crashes when it’s compiling it.

I figured out what caused the issue, sorta, and now I feel stupid. The error was comming from this part of the code:

public string Title {
        get {
            return Title;
        }
        set {
            if( value.Contains( "_" ) ) {
                Title = value.Replace( "_", " " );
            } else {
                Title = value;
            }
        }
    }

Alright, glad you got it sorted out!

If I may ask, why did that piece of code cause Unity to crash with an Access Violation Exception?

I think its a recursion problem with the set piece of code being looped, try adding a breakpoint there and see if thats the case.

That code did keep looping, but wouldn’t it cause a stackoverflow exception in Unity and not an ave (access violation exception) or something?

you might have multiple exceptions, also regardless you probably dont want it to loop. I have had this same problem but not quite sure how I fixed it. Ill look online and post anything that could help

I’ve fixed it by changing to this:

private string title, artist;

    public string Title {
        get {
            return title;
        }
        set {
            if( value.Contains( "_" ) ) {
                title = value.Replace( "_", " " );
            } else {
                title = value;
            }
        }
    }

    public string Artist {
        get {
            return artist;
        }
        set {
            if( value.Contains( "_" ) ) {
                artist = value.Replace( "_", " " );
            } else {
                artist = value;
            }
        }
    }