- Home /
Question by
Boxvilel · Jun 24, 2014 at 05:54 PM ·
cameramultiplayerfpsonline
My Camera won't activate trough script
Hello Unity Users. I'm trying to make an simple Multiplayer FPS and i want to activated my Camera trough script... I've made one script but this does not work.
using UnityEngine;
using System.Collections;
public class NetworkManager : MonoBehaviour {
void Start () {
Connect();
}
void Connect() {
PhotonNetwork.ConnectUsingSettings( "Project LuPaLu v001" );
}
void OnGUI() {
GUILayout.Label( PhotonNetwork.connectionStateDetailed.ToString() );
}
void OnJoinedLobby() {
PhotonNetwork.JoinRandomRoom();
}
void OnPhotonRandomJoinFailed() {
PhotonNetwork.CreateRoom( null );
}
void OnJoinedRoom() {
Debug.Log("Room Joined");
SpawnPlayer();
}
void SpawnPlayer() {
GameObject myPlayerGO = (GameObject)PhotonNetwork.Instantiate("PlayerController 1", Vector3.zero, Quaternion.identity, 0);
Debug.Log(myPlayerGO);
((MonoBehaviour)myPlayerGO.GetComponent("PlayerMovement")).enabled = true;
((MonoBehaviour)myPlayerGO.GetComponent("MouseLook")).enabled = true;
myPlayerGO.transform.FindChild("Main Camera").gameObject.SetActive(true);
}
}
Thanks for your Help.
Comment
Answer by Kaz_Yamof · Jun 24, 2014 at 06:27 PM
You can not find any inactive game object using Find.
http://answers.unity3d.com/questions/52560/gameobjectfind-work-on-inactive-objects.html
Your answer
Follow this Question
Related Questions
What's the best multiplayer option 0 Answers
Particle System Delay 0 Answers
Many Audio Listeners to multiplayer?? How? 1 Answer
Is it possible to get a unity game online? 1 Answer
Photon Multiplayer Animations 2 Answers