24 lines
548 B
C#
24 lines
548 B
C#
using UnityEngine;
|
|
using VContainer;
|
|
using VContainer.Unity;
|
|
|
|
namespace Player.Services
|
|
{
|
|
public class PlayerSpawnerService
|
|
{
|
|
[Inject] private IObjectResolver _container;
|
|
|
|
private GameObject _playerPrefab;
|
|
|
|
public PlayerSpawnerService()
|
|
{
|
|
_playerPrefab = Resources.Load<GameObject>("Player");
|
|
}
|
|
|
|
public void Spawn(Vector3 position)
|
|
{
|
|
var instance = _container.Instantiate(_playerPrefab);
|
|
instance.transform.position = position;
|
|
}
|
|
}
|
|
} |