Quantcast
Channel: Questions in topic: "tree"
Viewing all articles
Browse latest Browse all 513

How to get a GameObject from another GameObject

$
0
0
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); } }

Viewing all articles
Browse latest Browse all 513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>