Skip to main content
2 of 3
added 849 characters in body

Script not working on object in unity 2D

I was following a tutorial where the gameobject was to spawn randomly within the screen. The code I used is as follows.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine  ("Enter input");
            int answer = int.Parse(Console.ReadLine());
            
            switch(answer)
            {
                case 1: 
                    Console.WriteLine("You did it.");
                    break;

                case 2:
                    Console.WriteLine("You did it again");
                    break;

            
            }
            if( answer>2 || answer<1)
            {
                Console.WriteLine("You're an idiot.");
            }

                    
        }
    }
}

enter image description here

But on running the game it stays in the same location

Here is the code in text

enter image description here