Advertisement
Guest User

Untitled

a guest
Jan 17th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. class SceneManager: MonoBehaviour
  2. {
  3.   // Attach prefab via Unity Editor.
  4.   [SerializeField] private GameObject playerPrefab;
  5.  
  6.   [SerializeField] private Vector3 spawnPoint;
  7.  
  8.   [SerializeField] private SomeClass otherStuff;
  9.  
  10.   Awake()
  11.   {
  12.     var playerInstance = Instantiate(playerPrefab, spawnPoint, Quaternion.identity);
  13.  
  14.     // Send reference to player where it belongs:
  15.     otherStuff.Player = playerInstance;
  16.   }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement