I have a prefab, and i Want to access this prefab object from another object
the scene hierarchy has:
- Player
- Camera
- Background
- Floor(Prefab)
and the prefab hierarchy has:
-
Floor
-
DeleteTrigger
-
CreateTrigger
-
TransformReference
public class LevelGenerator : MonoBehaviour {
// Start is called before the first frame update[SerializeField] private GameObject FloorRef; private void Awake() { GameObject g = FloorRef.Find("Floor") Instantiate(FloorRef, new Vector3(10, 0), Quaternion.identity); }
}