how to solve this?
when i drag the CameraRaycaster script onto Main Camera at 09.09 minute on the section 10.
Can anybody help?
Thank you…
how to solve this?
when i drag the CameraRaycaster script onto Main Camera at 09.09 minute on the section 10.
Can anybody help?
Thank you…
Hi,
I recall this being an issue with Unity reporting the wrong error message. If you check, you’ll probably find that your script name and class name are not the same, and they need to be, as an example;
using UnityEngine;
public class Example : MonoBehaviour
{
// ....
}
The above would need to be saved as Example.cs, any differences and Unity will report an error, and with your current version, the wrong error
Saying that, from the screenshot, both the class name and file name look ok, for the class in which you are trying to add. Are there any others that don’t match?
See also;
Hi Rob
They are both same.
I think there is a problem matching the codes within versions…
I started a new project and added same objects but still receiving a different error. like:
They are both same.
Have you renamed a script within Unity though, after creating it? Unity will try to compile your code when you add a new script, I can see you have an error message at the bottom of the Unity editor regarding your CameraRaycaster, that would prevent it from compiling.
I haven’t seen this behaviour with the course materials, and I can open them using Unity 2018 without seeing this error.
Could you write out step by step reproduction steps that I could follow to test this also, e.g. including the location where you grabbed the assets from and so on. I’m happy to test this, although it may be tomorrow now.
I’m sorry, I don’t understand? “level 10 equals” ?
Oh, do you mean lecture 10 ?
I think possibly what has happened here is similar to the delay in creating a new script and unity hasnt finished applying the monobehaviour
When you click on the script and look at it in the inspector does it say something about the monobehaviour has not been applied?
If it does, Delete the script and readd it to the project and wait for that message to clear and then try adding it to the camera.
For future reference though if you used the link from the video to get here via the hamburger at the top left of the video window then the link under the lecture titled “Project changes” will take you to the github repo of that lecture.
The issue with using the course project files is you miss out of learning what the issue was and it could be something as simple as reapplying a script.
Let us know if this helps
Hi there.
I directly added the project changes document as my main folder but it didnt worked.gave 26 errors…
What to do?Didnt change anything.But received dozens of errors…
cheers
As mentioned in the PM Onur, I will take a look for you later today.
Hi @Onur_Ozyurt ,
I have opened the project changes zip (from GitHub) for lecture 10 in Unity 2018.2.7f1 and received 5 error messages, not 26.
If we take a look at the first error we see this;
Lines 12, 14 and 17 are Git merge messages, and these shouldn’t be here. I have made Ben and Rick aware of this.
If you make the following changes, these errors go away;
Update
method to use the deathSounds
array, instead of deathSound
variable, like so;AudioSource.PlayClipAtPoint(deathSounds[0], transform.position);
Be aware that the change I’ve made to the Update
method may not be in line with what is shown in the lecture, so you really should re-watch that lecture and check, what I have done just makes the first death sound in the array play.
After making these changes I was able to successfully run the project, the code compiled without error and I could move the player around in the Combat Soundbox and Text Town scenes.
Hope this helps
I think a similar issue just appeared on facebook and i remembered this.
FindObjectOfType should be FindObjectsOfType and can cause this type of error.
This might be a clue to whats happened in the script originally.
Turns out this was an issue with the URL provided under Resources on Udemy for the GitHub commit. It has been corrected now and should be ok to download.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
I had this exact same error today. I am using unity version 2018.2.6 and Visual Studio 2017.
I couldn’t get past the error until I clicked "build solution’ in visual studio.
Once I did, it went away. Maybe this will help someone in the future.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.