Hello once again, I am still unable to Build my game for others to play because there are other compile errors in the editor. There are two errors that are showing up and they are:
Error #1: Assets/Scripts/Enemy/EnemyMovement.cs(9,9): error CS0246: The type or namespace name NavMeshAgent' could not be found. Are you missing UnityEngine.AI’ using directive?
Error #2: Assets/_CompletedAssets/Scripts/Enemy/EnemyMovement.cs(11,9): error CS0246: The type or namespace name NavMeshAgent' could not be found. Are you missing UnityEngine.AI’ using directive?
What should I do so I can fix these errors and move on?
If fixed the errors, thank you, but there is one more error that popped up:
Error #1: Assets/_CompletedAssets/Scripts/Enemy/EnemyHealth.cs(1,12): error CS1525: Unexpected symbol Engine', expecting .‘, ::', ;’, <', or =’
Not only that, when I fixed the two errors, about 4 new errors showed up and 2 caution alerts showed up, one of them needing “using UnityEngine.AI;” and once I put it into the script of, if I remember right it was Enemy Health, they disappeared and this error showed up, so what exactly is going on?
I had put a space inbetween “using UnityEngine.AI” so that is what was causing the error, but some of those errors and caution alerts have come back and they are:
Error #1: Assets/Scripts/Managers/GameOverManager.cs(29,29): error CS1502: The best overloaded method match for `UnityEngine.Application.LoadLevel(int)’ has some invalid arguments
Error #2: Assets/Scripts/Managers/GameOverManager.cs(29,51): error CS1503: Argument #1' cannot convert method group’ expression to type `int’
Caution Alert #1: Assets/_CompletedAssets/SampleAssets/Effects/ImageEffects/Scripts/PostEffectsBase.cs(97,65): warning CS0618: UnityEngine.SystemInfo.supportsRenderTextures' is obsolete: supportsRenderTextures always returns true, no need to call it’
Caution Alert #2: Assets/_CompletedAssets/Scripts/Helpers/BeautyShot.cs(53,81): warning CS0618: UnityEditor.EditorApplication.currentScene' is obsolete: Use EditorSceneManager to see which scenes are currently loaded’
ignore the cautions for now. Error 1 means your passing something other than an integer to that method. Error #2 usually happens when you try to pass a method call to another method but pass a method reference instead. for example:
Notice how the second line is missing the parens after the method. Look at the error messages. They tell you the line numbers they are occurring. How did you make it this far? Did you copy and paste in a bunch of code?
I’ll check over the coding. Haha, no, I actually did the coding manually up until coding was already in place. I just followed what the videos showed me but I must’ve messed up some of the coding and didn’t notice it until later.
You’re trying to pass the Application.LoadLevel method into the method itself, which doesn’t make sense. Read the documentation for the method and you’ll see that it requires either an integer (index of the scene in build settings) or a string (name of the scene).
For example: Application.LoadLevel(“nameOfMyScene”);
That’s impossible for me to say for sure, since I don’t know the logic of your game. You should just pass it the name of the scene you want it to load.
But I guess since it is a script handling the end of the game with a variable called restartTimer, it should reload the current scene.
Okay, what would I need to send over to help you understand the logic of my game? I used the lessons of the Survival Shooter to give you an idea.
I can’t really say that there are scenes, as the game works as one giant scene. Once it starts up, it goes right into the game itself. This is what is making it hard for me to know what to put in place of Application.LoadLevel method.
I just want to make sure that it’s clear that I am using Unity’s Survival Shooter tutorial to make this game. Unity provided all of the scripts that I am using, so they should just work. Here is a link to the Survival Shooter tutorial page:
Have you tried going through the changes within the “Upgrade to 5.pdf” File?
That tutorial was made with Unity 4.6. But that pdf goes through all the changes needed to be able to run on Unity 5.
I recently went through the “Upgrade to 5.pdf” File, but it provided nothing to help me fix the errors plaguing my build of the Survival Shooter game, just what are some of the changes to Unity as a whole and some of its assets that helps the game function. What should I do next considering that I have been trying to get help on this subject for some months with no resolution?
“Application.LoadLevel(Application.LoadLevel)” should be “Application.LoadLevel(Application.loadedLevel);”, as stated in the code on the tutorial page Survival Shooter Training Day Phases - Unity Learn
If you’re using a quality code editor like Visual Studio it should be highlighting many of these errors in the code itself, and if you click on the errors in the Unity console it will open VS to where the error is occurring.
My bigger suggestion though would be to not try to follow Unity 4 tutorials when so much has changed in Unity5 & 2017.