I am new to Unity, going through training materials now and running into an issue with scripts.
I have a new project with a simple C# script (prints the word Test to the console). When I try to run it (clicking the Play button at the top of the screen) nothing happens. My screen changes color so Unity is in Play mode, but nothing appears in the console window. No errors or anything.
I have two machines. Scripts run fine on one but not the other. The configuration of the two is the same.
Details:
Platform: Windows 10
Unity: v4.7.2
Editor: VS 2015 Community
The current training doc I am using insists on using version 4.7 so I installed 4.7. I had 5.3 installed and wondered if there was a conflict so I uninstalled both versions, removed the folders from the Program Files (x86) folder to be certain and then did a clean install of 4.7.2 - still no luck.
I have made sure that all types of message are enabled in the console.
I am using VS2015 as my editor (VS Tools for Unity is installed). This seems to work fine - opens when needed and changes appear in the Unity editor.
I have deleted and rewritten the script file.
I have tried both file formats using Unix and Windows newline formats.
I have tried completely recreating the project from scratch.
Being that I am new to Unity and this is such a simple script, I assume there is something very obvious I am overlooking but at this point I am spending too much time and need to move on.
I assume since you say it runs fine on one, you have repeated the steps and the script is in your scene and everything is the same? Did you just copy the project from the working machine to the non-working machine?
So it looks like there is a file versioning problem of some kind. Based on your question I tried a couple additional things:
Machine A: scripts work Machine B: scripts don’t work
Copied the working project from A to B. Using File->Open Project, B does not recognize it as a Unity project. However if I dbl-click directly on the Main.unity file (on machine B), the editor loads the project and the scripts run. So it appears it is possible to run scripts on machine B as long as I don’t create the project on that machine.
I copied the project that was created on Machine B (the project where the scripts won’t run) to machine A. Using File->Open Project, machine A does not recognize it as a valid project. If I dbl-click on the Main.unity file the editor will open it - but the scripts will not run on Machine A.
I have confirmed that I have the same version of Unity on both machines. I find it interesting that when I create a project on one machine, the other does not recognize it as a valid project (The Open existing project dialog shows the “Selected folder is not a Unity project” message even though I can confirm there is a .unity file in the folder selected).
This also shows that if I create a project on machine A it will run on both machines. If I create a project on machine B it will not run on either.
I just removed Unity from Machine B and reinstalled again. I tried to go through all the user profile locations and remove every reference to Unity that I could find as well as deleting the Program Files (x86) folder - still no luck. Guess it is time to delve into the registry.
Your research was interesting. I’m not sure what could cause the problem on machine B projects honestly. I have copied project from work to home and home to work without issues, but the fact it doesn’t recognize it as a project is odd as well.
Unless for some strange reason when installing unity on Machine B it is skipping over something. If you install unity on Machine B and then copy over the installed version on Machine A and just overwrite the B installation, I wonder if that would fix it, or if it’s something else that is creating the issue(like you said, registry or in one of the other folders it may stick things in).
First though I want to acknowledge that, yes, I did verify that the .meta files transferred.
I had not thought about copying over the installation - although see below for this mornings adventure.
Thanks for checking in though.
As of this morning I decided to try one more thing. I removed Unity (v4.7.2) and deleted the program file folders - again. Yesterday I did go wading through the registry before reinstalling - Since that did not seem to make a difference I did not do that again this morning.
Anyway, I then installed v5.5.1 hoping that may be the issue. No luck. I am seeing exactly the same behavior. I figured this was grasping at straws because Machine A (where everything is working) I have 4.72 and 5.3.3 installed and they both work fine.
It occurs to me to wonder if this is a security issue however I store all my projects in a working data folder that I have full access to and have no issues with ANY other tools.
I still think the true pointer to the root issue is that fact that project files from one machine are not being recognized as projects by the other machine but I just can’t figure out why.
Thanks for reading through this. Still welcoming any suggestions…
OrbitoxTyson - Thank you for asking the right question!
The good news is I have solved the scripting issue. The steps I was taking to create my scripts were such that new scripts were not ending up as part of any game object’s hierarchy (from a misunderstanding of something stated in the tutorial I am going through). Now they are all working on both machines. I guess I had accidentally created them correctly on the other machine. I figured this was ultimately based on some basic thing I was missing.
Now this does not address why the two machines do not recognize each other’s files as projects but I will tackle that another day.
Good to hear you got it solved! I guess I had assumed that since you were doing some training materials that they were going exactly the same. But at least the problem is solved for now.
Early in the materials they have you create a script for a general editor related discussion. During that presentation they make the comment that how you create the script isn’t important and they even show you a couple other ways to create it. It so happens that they way they show you does add it to the game object hierarchy (but this is not called out).
Then a few lessons later they tell you to create a script and I guess they assume you will do it the same way (even though they have shown a few different ways. At that point I had no idea of why you might choose one method or the other.
I’m a beginner in Unity and C# and started doing some sample executions and from a video, I was trying to make a small game called Ninja jump and while doing that, I created a camera follow script but that was not executing. Can anyone please help me
not considering a necro-ing a thread but what helped me was: saving game object with the script not working(awaking/loading) in the build into its prefab, removing that game object from the scene, adding it back (with fixing all references if any). It now loads the script as intended however the behavior is still a little bit different to the play mode. I hope this will help someone.
Hey,
I have this issue too. I’m making Unity project for my school project and i have issue with movement, no errors and any thing like that. When I click the Play button, I’m trying to move but it’s not working. (I’m new to Unity too)
This is my script:
And I repeat, nobody can help you without more info. So make a new post, provide some info about the script and what you expect it to be doing and make sure you have it all setup correctly.
I created a 2d project in unity. This was my first project.I simply write movement script(just left and right movement). But it didn’t work, then I try debug.log statement to get values -1,0,1.But nothing happened. When I go to preferences, external tool and just press the regenerate project file , then the debug.log statement work. So I write the movement script again watching tutorial on youtube, and I copied the exact same code written there and saved , and when I hit play, on console it again showed debug.log Script which I had written first, I don’t know what kind of bug was that . Before that problem I had problem of intelliscence,which I fixed by installing Microsoft visual studio for unity by watching on youtube. And I am total beginner In unity, I don’t know unity In detail, I am just a student.