Question by
Wesley21spelde · Nov 20, 2016 at 03:36 PM ·
cameramultiplayersetactivepun
main Camera Not Getting activeated
Hey guys i have a problem with The player Main Camera it will not activate when my player spawns i think its becouse its set to Active false but i dont know how to fix this
its for my multiplayer game but when i spawn nothing happends
its in this line
myPlayerGO.transform.FindChild("MainCamera").gameObject.SetActive(true);
---------------------------------------------------------------------------------------------------
public void SpawnMyPlayer () {
if(spawnSpots == null)
{
Debug.LogError("ERROR");
return;
}
SpawnSpotNetwerk mySpawnSpot = spawnSpots[Random.Range (0, spawnSpots.Length) ];
GameObject myPlayerGO = (GameObject)PhotonNetwork.Instantiate("SpartanPlayer", mySpawnSpot.transform.position, mySpawnSpot.transform.rotation, 0);
// GameObject myPlayerGO = (GameObject)PhotonNetwork.Instantiate("SpartanPlayerMecanim", mySpawnSpot.transform.position, mySpawnSpot.transform.rotation, 0);
standbyCamera.SetActive(false);
myPlayerGO.GetComponent<RigidbodyFirstPersonController>().enabled = true;
//myPlayerGO.GetComponent<PlayerMovement>().enabled = true;//for mecanim player
//myPlayerGO.GetComponent<MouseLook>().enabled = true;
myPlayerGO.GetComponent<PlayerHealth>().enabled = true;
//myPlayerGO.GetComponent<RocketLouncherShoot>().enabled = true;
myPlayerGO.transform.FindChild("Spartan").gameObject.layer = 10;
myPlayerGO.transform.FindChild("MainCamera").gameObject.SetActive(true);
Debug.Log("MaincamActive");
myPlayerGO.GetComponent<UnityStandardAssets.ImageEffects.BloomAndFlares>().enabled = true;
myPlayerGO.GetComponent<UnityStandardAssets.ImageEffects.SunShafts>().enabled = true;
//myPlayerGO.transform.FindChild("GunCam").gameObject.SetActive(true);
//myPlayerGO.transform.FindChild("Spartan").gameObject.SetActive(false);
}
}
Comment
Your answer
Follow this Question
Related Questions
multiplayer game other player setactive false 0 Answers
Instantiation bug using Photon Unity Network (PUN) 0 Answers
How can I change the viewport rect of two active cameras at runtime? - Splitscreen Multiplayer 1 Answer
Multiplayer Camera Rotation On Client 0 Answers
Chess game multiplayer problem 1 Answer