- Home /
Make a public slot to load the scene dragged in there?
Ok so I have this OnTrigger script that loads whatever scene it says in the code. What I want it to do is for me to be able to make it public or something so that I can drag a scene from my project into a slot in the inspector and it loads that scene. Here is the script.
public void TutorialPicker()
{
SceneManager.LoadScene("PathScene");
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Player"))
{
SceneManager.LoadScene("PathScene");
}
}
As you can see, to load a new scene, I have to make an entirely new script and change the code (it's too time consuming). It's a simple little script that I made, but I do need help with it. What I mean by what I said above is being able to drag a scene into a slot of this script in the inspector, and then that scene being loaded when it something triggers the gameobject. I will be as clear as I possibly can.
Your answer
Follow this Question
Related Questions
is same code written in less lines, more beneficial ? 3 Answers
Want a script that can instantiate an object when MOVING inside the trigger 1 Answer
Problem with spawning with companion AI,Script not working properly when GameObject reactivated? 0 Answers
How to trigger animaton on two different Game Object's at the same time? 1 Answer