I have a Camera object that needs to follow my player (to create a Mini Map).
I'm using code from the Photon Viki Demo to spawn players,
and it what it does is it creates clones in the Hierarchy ex: Charpref(Clone)10001, Charpref(Clone)40222 and etc... for each player.
How can I get the Mini Map to have each clone as a Target?
**Code from the Photon Viking Demo (in the Asset Store).**
void StartGame()
{
Camera.main.farClipPlane = 100; //Main menu set this to 0.4 for a nicer BG
//prepare instantiation data for the viking: Randomly diable the axe and/or shield
bool[] enabledRenderers = new bool[2];
enabledRenderers[0] = Random.Range(0,2)==0;//Axe
enabledRenderers[1] = Random.Range(0, 2) == 0; ;//Shield
object[] objs = new object[1]; // Put our bool data in an object array, to send
objs[0] = enabledRenderers;
// Spawn our local player
PhotonNetwork.Instantiate(this.playerPrefabName, transform.position, Quaternion.identity, 0, objs);
}
**And here is the "Mini map"** :
using UnityEngine;
using System.Collections;
public class CameraFollow : MonoBehaviour {
public Transform Target;
void LateUpdate () {
transform.position = new Vector3 (Target.position.x, transform.position.y, Target.position.z);
}
}
**Edit:** I was thinking of possible tagging the Charpref with "Player" and making the Mini Map respond to anything with that tag attached, yet that still didn't work though.
↧