Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have 2 scenes. im trying to take an object from 1 scene and trigger it with another object on scene2, it doesnot work, but if two objects are on one scene it works, why? who knows? and i also want to trigger definite object

What I have tried:

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

public class Collision : MonoBehaviour
{
  public GameObject Key;
 
    void OnTriggerEnter2D(Collider2D Key)
    {
    
    Debug.Log("!!!!");
    }
    void Awake()
    {
        Key = GameObject.Find("Slot1");
    }

}
Posted
Updated 17-Sep-22 23:29pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900