#It s spawned in when the player breaks a
1 messages · Page 1 of 1 (latest)
Yes
you declare this public PlayerBehavior player; in the spawner script, and the tileDropPrefab's script
then, since the spawner is in the scene, you can assign the player to its public PlayerBehavior player; in the inspector
in the code where you Instantiate the tileDropPrefab, you pass the spawner's player reference to the tileDropPrefab.
the tileDropPrefab script should have something like
public void Initialize(PlayerBehavior player)
{
this.player = player;
}
and the spawner Instantiate code would be like
TileScript spawnedTile = Instantiate(tileDropPrefab);
spawnedTile.Initialize(player);