To Redirecting the scene in the unity engine.
Open the unity engine.
Create a new plane and create a cube and give color for the cube.
Next create sphere in the orgin and change the z-axis and Give the color for the sphere.
Create a tag for the Sphere and Make the sphere and cube as a Rigidbodies and Make the sphere use Gravity.
Create the C# script file in the Assets and write the Coding for the Redirecting.
Next Create a another new scene named as page2.
In File->Build settings and drop the both first scene and page2 scene in the Scenes in build setting.
Click the Build and run button in the Build settings and run the scene.
The Sphere after touching the cube it will disappeared and Press the key [R] the redircting to the new scene that is page2.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class PlayerController : MonoBehaviour
{
Rigidbody rb;
public GameObject WinText;
// 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.Space))
{
SceneManager.LoadScene("scene2");
}
}
private void OnMouseDown()
{
Destroy(gameObject);
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "object")
{
Destroy(collision.gameObject);
WinText.SetActive(true);
}
}
}
Thus the above C# coding is successfully redirecting the scene in the unity engine.