Scripts don't work in Unity3d - unity3d

I'm using Unity3d version 5.6 and when I change a script (using Mono), it works only after reloading Unity3d.
I have tried to install again Unity3d but nothing.
Thank you.

I fixed with: Edit -> Preferences -> General -> Auto Refresh

It sounds like your automatic Asset Refresh is off - this can be disabled per project, your scripts should reload if you press Ctrl + R (Cmd + R)
I personally use Console Enhanced Free to fine tune that behaviour, i.e. disable automatic reload if in Play Mode

sometimes you need to wait a few (up to 15) seconds for Unity to detect the change and recompile. You'll notice this pause if you are on the 'Scene' window and have an animated component present (eg particle engine). When the compilation occurs, Unity will become momentarily unresponsive. The 'Scene' will pause and a moment later will resume.
Good luck!

Make sure to save the script in VS before returning to Unity and playing your game. I've had problems like this before. A simple ctrl+s will usually do it, but sometimes I have to go to File > Save All and that gets it working. If all else fails, try reloading VS instead of Unity.

You can reload the scripts by CTRL + R
There is a setting in Preferences/General/Auto reload

By Default Auto Refresh is checked in Updated Unity version. If it's not checked you can checked it Unity->Preference->General->Auto Refresh

Related

How can I stop assets from being imported every time I make a change in VSCode on Mac?

Each time I alter something in the script, save and go into Unity it freezes for a second and imports all the assets. When I am using Visual Studio Mac I don't have a similar problem. How can I fix it?
Try Edit -> Preferences and uncheck the auto refresh:
After that you need to refresh manually with ctrl + R each time you make a change for the project to compile and try the changes you make in the project before you click play.
That allows you to change whatever you want with no refreshing and then when you want to check your changes you do ctrl + R, wait for it to compile and run. It makes sense in big projects where compilation times are big.

Attach debug to process Unity doesn't work

I created new 3d unity project, then in asserts I created c# script if I click on it twice Visual Studio 2017 is opened. Then I would like to make a debug, so I set debug point and click in Unity on play button and nothing happes.
There is no attach button or something like this.
What am I doing wrong?
This happens randomly to me as well. The way I fix it it to go Unity->Edit Menu->Preferences->External Tools, and set the External Script Editor to something else, and then revert it back to Visual Studio.
If that fails, just underneath that dropdown there is a button Regenerate Project Files, which helps when your VS project files get messed up.
Also, upgrading to the latest version of Visual Studio and Unity Tools for VS could help.
My bad if I misunderstood this question, but all you have to do for unity to update your scripts for your game is ctrl + s, this will let unity know you made changes to the script and it will apply those changes.

Buttons broken using new Input System

I've got a problem that is seemingly impossible to debug. My project originally started using 2019.2 and upgraded to 2019.3 without any problems. I then installed the preview package for the new input system.
This "disabled" all the buttons in that they are visible in the editor and during run time but they are impossible to click on or interact with.
To reproduce this issue I tried:
Creating a new empty 2D project
Installing and switching to the new Input System
Importing their demo scene from the package manager
At this point I tried running each scene. All of them worked except "SimpleDemo_UsingActions.unity".
I added a button to the "SimpleDemo_UsingPlayerInput.unity" and added a script to the button. With a function:
public void Button()
{
Debug.Log("Button Pressed");
}
I ran this scene and it worked! I could move around shoot the cubes that is built into the script and I could click on the button and it showed in the log.
For this reason I am stumped. I do not know how to debug this issue.
Can I have some advice? Has anyone had a similar issue or know how I would go about debugging this?
I managed to find the answer. For some reason using the new input system's "InputSystemUIInputModule" breaks all the UI and just does not work.
I fixed it by just deleting my EventSystem and creating a new one in the scene.
Do not. and I repeat. Do Not use the new input system's manager for the event system.
I write answer because it's first result in google.
To get rid of this, select EventSystem in hierarchy, then in inspector you should see warning and button to replace old input system with new.
Unity ver. 2019.4.1
Input System ver. 1.0.0
I'm still currently testing but I manage to get something by duplicating the defaultInputActions.inputactions file from the Packages >> Input System >> InputSystem >> Plugins >> PlayerInput.
I realized that that .inputactions has a UI Action Maps. I added more Action Maps and did some testing, the added action maps works and buttons are somewhat reacting as well.
Just sharing this now so that more developers can test this with me and hopefully find a way to work around this major issue.
Had the same issue. Make sure that the input system package, does not have any devices inside... It worked for me after migrating from the Previous Input System

Visual Studio Code window is not appearing

I've encountered a very strange bug with Microsoft Visual Studio Code. I've been using VSCode for a few months now and never had this issue. When I open VSCode, the window just doesn't appear. The app is definitely open, because when I hover over the icon on my taskbar I can see what is being displayed in the app:
Unfortunately, when I click on it, the window does not appear.... I've uninstalled and reinstalled, deleted cache, tried older versions and nothing has worked. Has anyone else encountered this and fixed it? Any advice?
hover over VSCode icon in taskbar
right click on it
click on "New Window"
That should do it.
I had something similar. It appears that the window is just off-screen. I've used my DisplayFusion display manager - to move windows to center/top where I could handle it myself. I expect it'll also work using <Win> + <←> (maximize window to left side of screen).
In my case, the issue went away when uninstalling the GlassIt-VSC extension. I tried modifying the opacity of the window and then it disappeared. I highly suggest you try uninstalling this extension.
In my case I had connected HDMI cable but due to power off my monitor was off, but when I disconnected hdmi cable; VS code visible on my screen.
Got the answer since no one was helping.
Go to view.
Click solution explorer.
It should show the name of your project.
Click the small arrow at the beginning of the heading of your project.
Click source files.
Click yourproject.cpp.
Thank you.
I encountered a similar issue with a plugin called GlassIt while I was playing with a property called "glassit.alpha" somehow it went to 1 (possibly I changed it accidentally) and nothing showed up. (here's an image where you can slightly see that I set alpha to 20)
what i did was to just edit the %appdata%\..\Roaming\Code\User\Settings.json and set "glassit.alpha": 1, to 255
UPDATE I just realised there was already an answer I didn't see while I was writing this post
I had this issue during a remote desktop session and could bring the VSC window back via hitting F11 (via the onscreen keyboard in my case, since the F11 key on my keyboard was being captured by the host system).
In my case, I have a dual monitor setup, and the laptop was in clamshell mode. However, the laptop's built-in monitor was recognized as a third monitor, and VsCode was going there.

In Unity, How to Stop Popup for "Show Unity Splashscreen"

I'm just now learning how to use Unity to mess around in SteamVR. Every time I press the play button to test out my scene, I get this annoying popup. The tutorial I'm following doesn't have this problem. How can I get the popup to go away for good? I always "Accept" it and it tells me "I made the right choice" but then it just comes back next time. And... it pops up randomly as well...
Go to Assets/SteamVR/Editor/SteamVR_Settings.cs and change recommended_ShowUnitySplashScreen to true. You'll have to do this each time you update the SteamVR Unity Asset, until they fix it to check which edition you're using.
The location changed. I found the bool recommended_ShowUnitySplashScreen in Assets\SteamVR\Editor\SteamVR_UnitySettingsWindow.cs.