Is there a way i can choose where the Orange_Object and Red_Object are being Loaded?
private void OnTriggerStay2D(Collider2D collision)
{
string thisGameobjectName;
string collisionGameobjectName;
thisGameobjectName = gameObject.name.Substring(0, name.IndexOf("_"));
collisionGameobjectName = collision.gameObject.name.Substring(0, name.IndexOf("_"));
if (mouseButtonReleased && thisGameobjectName == "Yellow" && thisGameobjectName == collisionGameobjectName)
{
Instantiate(Resources.Load("Orange_Object"), transform.position, Quaternion.identity);
mouseButtonReleased = false;
Destroy(collision.gameObject);
Destroy(gameObject);
}
else if (mouseButtonReleased && thisGameobjectName == "Orange" && thisGameobjectName == collisionGameobjectName)
{
Instantiate(Resources.Load("Red_Object"), transform.position, Quaternion.identity);
mouseButtonReleased = false;
Destroy(collision.gameObject);
Destroy(gameObject);
}
}