14 lines
321 B
C#
14 lines
321 B
C#
using UnityEngine;
|
|
|
|
public class TreeSpawner : MonoBehaviour
|
|
{
|
|
public GameObject treePrefab;
|
|
public Transform spawnPoint;
|
|
|
|
private void OnTriggerEnter2D(Collider2D other)
|
|
{
|
|
if (!other.CompareTag("Player")) return;
|
|
|
|
Instantiate(treePrefab, spawnPoint.position, Quaternion.identity);
|
|
}
|
|
} |