How to get a script to check an area of the game screen and not just one finite point?
Hey, I'm trying to get the code to check an area of the map. I am new to Unity and C# Script so if you could help it would be greatly appreciated. Below is the script I wrote, but it only searches a specific point. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;
public class TestingScript : MonoBehaviour
{
void Update()
{
if (transform.position.x <= -2.4958612)
{
if (transform.position.y <= -7.286026)
{
SceneManager.LoadScene("Dungeon1");
}
}
}
}
Thank you!
Answer by shaileshteli14 · Apr 17, 2020 at 09:58 AM
@Zinasterath I answered exactly the same thing few hours ago. Check out: https://answers.unity.com/questions/1719319/how-to-load-a-scene-on-collision-top-down-2d.html?childToView=1719389#answer-1719389
Your answer
![](https://koobas.hobune.stream/wayback/20220612231657im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can i get error when failed connect to server? 1 Answer
Null Refrence Expection 2 Answers
C # script taking values from one object and modifying another. 0 Answers
click on object then zoom in 0 Answers