Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

errors

why it shows errors I have installed it 10 days ago but now it is showing errors

Best Answer

Answers

  • Good morning. I am following how to do a 2D platform game in unity on you youtube channel and I am having some issue with the EnemyAI script. I tried to follow The tutorial and even copying the scripts from your website but I still have the same error message:

    Here is my script:

    I have a Mac book Air updated to the newest version.

    I am using Unity version 2020.1.13f1 Personal

    I am coding with Visual Studio Code version 1.51.1


    Can you please help me with the mistake regarding the return of the IEnumerator please?

    Thanks a lot😎

  • Hey im having a different problem. I am extremely new to coding and have been trying to create a program which uses all the parts taught in the brackeys c # learning videos. I am having a problem with the case/switch condition. I cannot understand what i did wrong yet there is still an error, any help??



    using System;


    namespace _1_

    {

        class Program

        {

            static void Main(string[] args)

            {

                //Names The Window

                Console.Title = "Skynet" ;

                

                //Changes the text color

                Console.ForegroundColor = ConsoleColor.White ;

                

                //Changes the background color for the text

                Console.BackgroundColor = ConsoleColor.Black ;

                

                //Changes the height of the window, uses the variable as amount of lines tall

                Console.WindowHeight = 15 ;

                

                //Changes the width of the window, uses the variable 

                //to make the window x amount of characters long

                Console.WindowWidth =  100;

                

                //Prdoubles whater we give in the bracket, similar to prdouble statement in python

                Console.WriteLine("Hey! \nWhat is your name");

                

                // Creats variable and assigns the value as whaterevr user inputs.

                // The Console.ReadLine() statement is added so the user can assign the variable

                // We can replace the Console.ReadLine() statement with "<your text>" to give it its own value

                string userName = Console.ReadLine();

                

                //Here the + username adds our variable's string value to the prdoubleed line

                Console.WriteLine("Hello " + userName) ;

                

                Console.WriteLine("My name is DestructoBot5000.");

                

                // We can add \n where ever we want so that our text is broken into multiple lines

                Console.WriteLine("\nHey! \nWhat is your favourite color");

                

                // Accepts user input

                Console.ReadLine();

                

                Console.WriteLine("Nice!\nMine is");


                Console.ForegroundColor = ConsoleColor.Red ;


                Console.WriteLine("Death");

                

                Console.ReadKey();

                

                Console.ForegroundColor = ConsoleColor.White ;

                Console.WriteLine("\n\nLeave that for now,\nJust know that one wrong move can lead to events you may not like") ;

                

                Console.ReadKey();

                

                Console.WriteLine("\nAnyways, did you know i can act as a calculator as well?") ;

                

                Console.WriteLine("Tell me any two numbers and I'll add them for you");

                

                Console.WriteLine("\nWhat is the first number?");

                

                //Here the Convert.To<whatever> changes the user input from sting(which is the defualt input) to whatever we tell it

                double num1 = Convert.ToDouble(Console.ReadLine());

                

                Console.WriteLine( "\nAnd what is the second number?" ) ;

                

                double num2 = Convert.ToDouble(Console.ReadLine());


                double answer = num1 + num2 ;


                Console.WriteLine("\nHa, I could have done that in my sleep, BTW the answer is " + answer);


                Console.ReadKey();

                

                Console.WriteLine("\n\nDid you know i can subtract 2 numbers too, try it!");

                

                Console.WriteLine("\nWhat is the first number?");

                

                double num3 = Convert.ToDouble(Console.ReadLine());

                

                Console.WriteLine( "\nAnd what is the second number?" ) ;

                

                double num4 = Convert.ToDouble(Console.ReadLine());


                double answer2 = num3 - num4 ;


                Console.WriteLine("\nHa, that was easy too, BTW the answer is " + answer2);

               

                Console.ReadKey();


                Console.WriteLine("\n\nHey, I can multiply two numbers as well, lets try that out!");

                

                Console.WriteLine("\nWhat is the first number?");

                

                double num5 = Convert.ToDouble(Console.ReadLine());

                

                Console.WriteLine( "\nAnd what is the second number?" ) ;

                

                double num6 = Convert.ToDouble(Console.ReadLine());


                double answer3 = num5 * num6 ;


                Console.WriteLine("\nHaha, you keep giving me easy questions, and I keep answering them. By the way the result is " + answer3);


                Console.ReadKey();


                Console.WriteLine("\n\nHey, I can divide two numbers as, lets try that out as well!");

                

                Console.WriteLine("\nWhat is the first number?");

                

                double num7 = Convert.ToDouble(Console.ReadLine());

                

                Console.WriteLine( "\nAnd what is the second number?" ) ;

                

                double num8 = Convert.ToDouble(Console.ReadLine());


                double answer4 = num7 / num8 ;


                Console.WriteLine("\nHa, I could have done that in my sleep, BTW the answer is " + answer4);


                Console.WriteLine("\nI can also find the average of three numbers") ;

                

                Console.WriteLine("What is the first number?") ;

                

                double avg1 = Convert.ToDouble(Console.ReadLine());


                Console.WriteLine("What is the second number?");


                double avg2 = Convert.ToDouble(Console.ReadLine()) ;


                Console.WriteLine("And what is the third number?");

                

                double avg3 = Convert.ToDouble(Console.ReadLine()) ; 


                double ans = (avg1 + avg2 + avg3) / 3 ;

                

                Console.WriteLine("That was soooooo easy, the anser is " + ans ) ;

                

                Console.WriteLine("Now I'm going to ask you a question.\nWhat is 1 x 2 x 3 x 4 x 5 ?") ;

                

                int userAnswer = Convert.ToInt32(Console.ReadLine()) ;

                 

                if ( userAnswer == 120)

                {

                

                Console.WriteLine("You're smarter than I thought") ;


                }   


                else 


                {


                 Console.WriteLine("Your're Dumber than T thought") ;


                }


                Console.WriteLine("Ok, I'll give you something easier. \nI'm thinking of a number between one and five, if you can guess it, I won't kill you."); 

                

                int robothought = 3 ;

      

                int numg = Convert.ToInt32(Console.ReadLine()) ;


                switch (robothought)


                {

                  case 3:

                     Console.WriteLine("I dont know how you guessed that") ;

                     Console.ReadKey() ;

                     Console.WriteLine("Sorry I have to go, meet you in") ;

                     Console.ForegroundColor = ConsoleColor.Red ;

                     Console.BackgroundColor = ConsoleColor.White ;

                     Console.WriteLine("HELL") ;

                  default:

                     Console.ForegroundColor = ConsoleColor.Red ;

                     Console.BackgroundColor = ConsoleColor.White ;

                     Console.WriteLine("You died") ;

                // waits for userinput

                Console.ReadKey();

            }

        }

    }

  • Hey @TEX you may want to write on line 53

    yield return null;
    

    (as you want to return nothing)


    use

    yield return
    

    statements in Coroutines.

  • @Frag I understood that your problem is i the last bunch of lines, but the errors and line numbers would be more clear if you attach the screenshots as others here did

  • Thank you very much :)

Sign In or Register to comment.