Jump to content
Unity Insider Forum

Unity hangs completely when I start a script


Recommended Posts

I have bound a script to an object and now I want to execute the script by clicking on the start icon but then Unity hangs completely. There is no error message and I can't close it anymore. C# is open only as info

Link to comment
Share on other sites

I highly doubt that. The behavior you described is caused by an endless loop, which has to be coded somewhere. And it'as rather unlikely that it's a Unity issue that noone else has discovered. So if it's not your custom code, then there's some Plugin involved that you added to the project.

Link to comment
Share on other sites

If i delete Unity and reinstall it. Then it might help, I don`t have any plugins and the code are simple arrays or methods. The code always just has on of it at a time since I try to learn coding but it doesn`t matter if I replace the code with sth. else. But it`s always simple. 

If I knew where the Project would be safed, it would be maybe helful to reinstall unity

Link to comment
Share on other sites

Reinstalling Unity won't change anything. The issue is somewhere in your project. Can you create a new scene, a GameObject in it, then drop a script on it and have it freeze? Then post that script here so we can have a look at it?

Link to comment
Share on other sites

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DummyScript : MonoBehaviour
{
    private Rigidbody rigidbody;

    void Start()
    {
        rigidbody = GetComponent<Rigidbody>();
        
    }

    private void OnMouseEnter()
    {
        rigidbody.AddForce(new Vector3(0, 10, 0), ForceMode.Impulse);
    }
    void Update()
    {
        
    }
}

 

Link to comment
Share on other sites

A new preject works! The old one isn`t important since there was just some test code on it. But it could be that I once removed a component of the cube that I had in the Scene. But I don`t know if I deleted a wrong on.  But I don`t think this would lead to this freezing problem

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...