Search Unity

Survival Shooter "Error" Continued....

Discussion in 'Editor & General Support' started by BlackAceZero777, Mar 15, 2017.

  1. BlackAceZero777

    BlackAceZero777

    Joined:
    Jul 27, 2016
    Posts:
    24
    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?
     
  2. mikael_juhala

    mikael_juhala

    Joined:
    Mar 9, 2015
    Posts:
    247
    Try adding "using UnityEngine.AI;" at the beginning of EnemyMovement.cs.
     
  3. BlackAceZero777

    BlackAceZero777

    Joined:
    Jul 27, 2016
    Posts:
    24
    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?
     
  4. mikael_juhala

    mikael_juhala

    Joined:
    Mar 9, 2015
    Posts:
    247
    You have some wrong symbols in the script, thus it's saying "unexpected symbol". What exactly is in the beginning of your script?
     
  5. BlackAceZero777

    BlackAceZero777

    Joined:
    Jul 27, 2016
    Posts:
    24
    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'
     
  6. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    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:

    Code (csharp):
    1.  
    2. Debug.Log(Guid.NewGuid());
    3. Debug.Log(Guid.NewGuid);
    4.  
    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?
     
  7. BlackAceZero777

    BlackAceZero777

    Joined:
    Jul 27, 2016
    Posts:
    24

    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.
     
  8. BlackAceZero777

    BlackAceZero777

    Joined:
    Jul 27, 2016
    Posts:
    24
    Here is a picture of the coding for Error #2.
     

    Attached Files:

  9. mikael_juhala

    mikael_juhala

    Joined:
    Mar 9, 2015
    Posts:
    247
    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");
     
  10. BlackAceZero777

    BlackAceZero777

    Joined:
    Jul 27, 2016
    Posts:
    24
    Ok, so since this coding is part of the "GameOverManager.cs" would I put the Game Over scene in the string?
     
  11. mikael_juhala

    mikael_juhala

    Joined:
    Mar 9, 2015
    Posts:
    247
    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.
     
  12. BlackAceZero777

    BlackAceZero777

    Joined:
    Jul 27, 2016
    Posts:
    24
    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.
     
  13. BlackAceZero777

    BlackAceZero777

    Joined:
    Jul 27, 2016
    Posts:
    24
    Mikael,

    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:


    Here is the page with all of the assets, including the scripts for this tutorial that you can download using this link:


    Can you download the game so that you can help me to diagnose this problem?

    I appreciate your help Mikael.
     
  14. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    294
    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.
     
  15. BlackAceZero777

    BlackAceZero777

    Joined:
    Jul 27, 2016
    Posts:
    24

    I was not aware of this PDF File and will go on ahead and look through it.
     
  16. BlackAceZero777

    BlackAceZero777

    Joined:
    Jul 27, 2016
    Posts:
    24
    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?
     
  17. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,042
  18. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    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.