Question by
Zuc16th · Jun 04 at 09:40 AM ·
2dtransform.position
Is there a better way to transform.position of a specific prefabs from one to another? 2Dgame
right now I do like this but the GameReset() func isnt working as I has intend it to be.
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI;
public class Reset : MonoBehaviour { //player 1 public GameObject player1; [SerializeField] private Transform spawnPoint1;
//player 2
public GameObject player2;
[SerializeField]
private Transform spawnPoint2;
//ball
public GameObject ball1;
[SerializeField]*
private Transform spawnPoint3;
private void GameReset() { player1.transform.position = spawnPoint1.position; player2.transform.position = spawnPoint2.position; ball1.transform.position = spawnPoint3.position; } }
//the idea is to transform.position of the "multiply-things" to the empty-object name "spawnpoint" by multiply location.
Comment