Skip to main content
added 2 characters in body
Source Link

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;Collections;
using System.Linq;
using SystemCollections.Text;Generic;
using System.Threading.Tasks;

namespace TestUnityEngine;
{
   public class Program
  NewBehaviourScript : MonoBehaviour
{
        static void Main(string[] args)
// Start is called before the first frame {update
            Console.WriteLine// jump ("Enterlocation input");support
   
    //screen dimensions  
    intfloat answerminX = int.Parse(Console-3.ReadLine());77f;
         float maxX = 3.73f;
         float minY = switch(answer)-2.13f;
    float maxY = 2.16f;

    //timer {support
       const float TotalJumpDelaySeconds = 1;
    float caseelapsedJumpTimeSeconds 1:= 0;
      
    // Update is called once per frame
    void Console.WriteLineUpdate("You did it.");
     {
        //update timer and check if its done break;

               elapsedJumpTimeSeconds case+= 2:Time.deltaTime;
             
        Console.WriteLineif("You didelapsedJumpTimeSeconds it>= again"TotalJumpDelaySeconds);
              {  
     break;

       elapsedJumpTimeSeconds = 0;
   
          Vector3 position = }transform.position;
            if(position.x answer>2= ||Random.Range(minX, answer<1maxX)
            {;
              position.y = ConsoleRandom.WriteLineRange("You're anminY, idiot."maxY);
     
        }

                    
        }
    }
} 

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

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

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

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
    // Start is called before the first frame update
    // jump location support
 
    //screen dimensions  
    float minX = -3.77f;
    float maxX = 3.73f;
    float minY = -2.13f;
    float maxY = 2.16f;

    //timer support
    const float TotalJumpDelaySeconds = 1;
    float elapsedJumpTimeSeconds = 0;
     
    // Update is called once per frame
    void Update()
    {
        //update timer and check if its done 
        elapsedJumpTimeSeconds += Time.deltaTime;
         
        if(elapsedJumpTimeSeconds >= TotalJumpDelaySeconds)
        {  
            elapsedJumpTimeSeconds = 0;
            Vector3 position = transform.position;
            position.x = Random.Range(minX, maxX);
            position.y = Random.Range(minY, maxY);
 
        }


    }
}
 

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

added 849 characters in body
Source Link

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

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

enter image description here

But on running the game it stays in the same location

enter image description here

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

Source Link

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.

enter image description here

But on running the game it stays in the same location

enter image description here