Monodevelop vs Visual Studio 2017 vs older visual studio for Terminal.WriteLine

Trying to get my head around the various script editors. I see that Terminal.WriteLine does not work in Monodevelop. Even though we are told to use Visual studio, the previous course uses the built in Monodevelop. What would need to be done for Terminal.WriteLine to work in Monodevelop? I believe an answer to this will enhance understanding. And from which version of Visual Studio will Terminal.WriteLine work?

I was also wondering about the decision to use Visual Studio in this course, rather than MonoDevelop. I understand that Visual Studio has more features than MonoDevelop - probably appreciated by coders more experienced than myself.

Anyway, I just followed along the course using Visual Studio. It’s interesting that something would work in Visual Studio but not MonoDevelop. That suggests that the difference goes deeper than just features.

That is really strange, whatever works in visual studio should work in monodevelop. The only thing I can think of is your script isn’t in the right place and it’s not actually the IDE’s fault.

Best to check that first anyway!

1 Like

Terminal.WriteLine() is a function in the Terminal.cs script, so it sounds like there’s some other problem… Assuming you imported the entire .unitypackage, my next thought would be to ask if you “opened” the script from within Unity or outside? I’m not even sure it would make a difference, but I’m not at a guru-level to know off-hand exactly what the problem is, sorry.

Yeah the terminal functions are “static” meaning they should be available to the whole project. I suspect something else is wrong.

I’m sure you did but just checking, you saved from MonoDevelop before going back to unity? And not seeing any errors in the console?

In order for the members of classes/libraries to be available to the Intellisense within Visual Studio, the relevant references to those libraries would need to be in place.

If only the script has been opened, and not the actual project, the references to the Unity libraries will not be loaded. By default, many .Net libraries will be available as part of the IDE.

If you open the script from Unity, Unity would open the project as well as the script and should load this references correctly, if it doesn’t, you will receive a “Failed to load assembly” message and the Solution Explorer will show a project has failed to load.

In addition, if the script has any syntax errors which prevent it from building, and the new method was added after the last build, nothing will know about the new method, as the library for your project hasn’t been built.

If you could provide some further information please @Sorendark, with regards to how you are editing your script, how you launch the IDE to edit them, and whether the scripts already contain syntax errors.

3 Likes

Thanks all for your feedback. Here is what happened. I downloaded Unity 2017, but inadvertently did not download Visual studio 2017, as I download the default setting (which did not have the vs 2017 box checked). So once Unity downloaded, I created a new project and started to write the code. At first I did not see that Monodevelop had opened as the text editor. So when I started to type out Terminal…there was no intilisense, and after typing the period there was no prompt-box, and the whole statement failed when I hit F8. It was then that I realised I was in Mono develop.

I then struggled to download vs2017 that comes with unity. If I may, I think it would be appropriate to add a section on how to download this if someone (like me), did not download it. Ben states it is easy to do this later…but it was not for me. Things are easy when you know how, but not so when you don’t. I still don’t know if I did the right thing, and fealt that there should be a better way to install the component you want. For me I went through the process of re-downloading unity 2017, but then unchecked everything except the vs2017 check box. My concern at the time is that this would overwrite what was previously downloaded and delete unity but install vs2017. This was not the case, but does show what was going through my mind…and Im sure I wont be the only one to go through this. Any how, once vs2017 was installed, I selected it as shown in the course, and started to type out Term…and intelisense did the rest.

Also see next post which is related to this matter but from a different perspective.

1 Like

Still on the topic of differences between text editors:

I am also working my way through the sister course and have recently completed the block breaker module. From the beginning we are instructed to use Unity 4.6. I started that course with Unity 4.6. I’m not sure what happened exactly, but at one point had accepted to upgrade unity based on an auto pop up prompt advising me to do so. Anyway, it looks like I ended up with unity 5.5. This worked fine for the prison break scenario, but not so much for the block breaker scenario. The first thing I noticed is that the LevelManager method was obsolete, and had to be changed with SceneManager method…but I could not get Scenemanager to work. However despite the compiler complaining a bit, the LevelManager code worked just fine. However the Audio coding used in unity 4.6 would not work as shown in unity 5.5. The same applied for rigidbody.velocity. I would have thought that later versions of unity are backward compatible with older versions, but appears not to be so. In an earlier post others mentioned that Terminal.Writeline should have worked in both Monodevelop and vs2017. It’s the stuff I experienced in this post, which prompted me to write the first post of this chain in the first place. To me, it seems that different editors are capable of executing different code, and I am hoping to get my head around this. I would have thought by now, that code was standardised.

This comment may not be helpful @Sorendark, but: Unity underwent significant changes under the hood from 4 to 5, and it seems onwards. Certain classes have changed, meant code that works in 5.x wouldn’t work in 4.x, because the class isn’t available to support it. I assume that’s what you meant by code standardisation. Really, its continued development of Unity, improvements hopefully, that is the cause. Sometimes backwards compatibility can’t be supported. I did the whole first course in 5.6, and had to use the community and web to find answers as to how to write certain statements, that replaced whatever was in the course.

I’m doing the newer course now, about to start with VS 2017 :slight_smile: bye bye mono. I actually saw this thread because I was wondering why mono was canned for this particular course. I guess I’ll find out.

2 Likes

Just to add, the required changes from the version of Unity used in the original course (4.6.x) and later versions are covered in a Google Doc which is made available under Resources in lecture 8.

In addition, they are available here;

Privacy & Terms