Chances are your camera is not pointing the right way.
If you click on your camera it will show you a box in the scene that is what the camera is looking at. Move that about until your camera is looking at the scene.
Hello boys and girls. My name is Michael and I’m new in this forum. I apologize right now if I’m wrong here, but I reopen this old tread because my questionrelates to the aforementioned tutorial.
In the tutorial, at point “DemoScript [Revision 5]” I’ll get two error:
Assets/MyScript/DemoScript.cs(9,15): error CS0029: Cannot implicitly convert type string' to int’
Assets/MyScript/DemoScript.cs(25,10): error CS0029: Cannot implicitly convert type int' to string’
It refers to the fact that it is not possible to convert integer to string and vice versa. Now, I’ve tried many things, but failed. you have an idea about?
I’m new to C # so I find it difficult to understand how to convert an integer with a string, and having only written in MAXScript (I was wrong I know) do not find it so immediately. I know the use of .ToString, but here it does not work…
I use Unity version 5.6.0f3 Personal for Win
I ask you moderators that if I have the wrong place, can move my question in the right place. Thanks!!
That does appear to be a problem with the script’s text as shown on the website - line 23 should read
int AddTwo (int var1, int var2) {
While I haven’t viewed the tutorial in its entirety, this seems to not be a problem on the video (I see the line at 46:04 and it says int on the video), so I think it’s just a problem with someone have mistyped it for the website.
According to your point of view, is a problem of incompatibility between my version of Unity (5.6.0f3) and the one used for the tutorial (4.6)? Honestly, it is not the first time that I see this error… bàh. I also looked in the help script in Unity the voice “AddTwo”, but it does not exist … it is difficult to study in this way, with tutorials that are wrong! hahahahah
As @StarManta said, it’s only wrong in the text. The video is correct. Just change line 23 to look like StarManta typed and that error will go away.
As a related note, while I understand your frustration with having typos and inconsistencies between Unity versions in the tutorial, you should consider it more of an invitation to learn than a hinderance. After all, if you really understood what the words “string” and “int” do, you’d spot that mistake in the tutorial code and fix it right away. So any time you run into a problem you don’t understand, Google the error and find out what it means. Look up the relevant code in the Unity API or C# reference of your choice, and in time you’ll figure it out.
You’re right, and before posting questions here are means inconceivable much time trying to fix it. I always like to learn with basic research in google, book etc. I’m used to read a lot more than to see video heheheheh
looking on google to correct the error " Cannot implicitly convert type string' to int’" I always found as a solution “.ToString” metod, and certainly it is not the right solution for this case.
Anyway thank you very much for your support and patience
I’m using v5.6 and the c# coding syntax has changed. For instance enabled is no longer valid for turning object on/off (light example). I figured out to use SetActive, but I’m looking for a Unity 5.6 version of these tutorials or at least a text addendum under the video pointing out what changed.
Past precedence has shown that when Unity’s tutorials are no longer up-to-date with the latest release they simply take them down and replace them with completely new tutorials. The Stealth tutorial was taken down for this reason.
Instead of waiting for the tutorials to be updated I recommend getting into the habit of reading the release notes with each new release. If you click the “API Changes” entry in the side menu it’ll show you what you need to see for scripting.
Very occasionally a community member makes up the gap. I did it for a roll a ball on 4.6 for a while. But normally Unity simply removes the out of date material once enough errors have accumulated.