Code Monkey home page Code Monkey logo

redirecting-the-scene's Introduction

Redirecting-the-scene

Aim:

To Redirecting the scene in the unity engine.

Algorithm:

Step 1:

To open the unity engine.

Step 2:

Create a new plane and create a cube and give color for the cube.

Step 3:

Next create sphere in the orgin and change the z-axis and Give the color for the sphere.

Step 4:

Create a tag for the Sphere and Make the sphere and cube as a Rigidbodies and Make the sphere use Gravity.

Step 5:

Create the C# script file in the Assets and write the Coding for the Redirecting to the page2 after hit the sphere to cube.

Step 6:

Next Create a another new scene named as page2.

Step 7

In File->Build settings and drop the both first scene and page2 scene in the Scenes in build setting.

Step 8:

Click the Build and run button in the Build settings and run the scene.

Step 9:

The Sphere after touching the cube it will disappeared and Press the key [R] the redircting to the new scene that is page2.

Program:

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

public class hello : MonoBehaviour
{
    Rigidbody rb;
    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.R))
        {
            SceneManager.LoadScene("lev2");
        }
    }
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "sphere") ;
            Destroy(collision.gameObject);
    }
}

Output:

Scene 1:

ouput

After the Ball Hit the cube:

output

Redirected scene 2:

output

Result:

The above C# coding is successfully redirecting the scene in the unity engine.

redirecting-the-scene's People

Contributors

archanasharikalharinarayanan avatar jegathish-16 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.