- Home /
Photon and UFPS Camera Issue
In UFPS (Ultimate FPS) the Camera(s) are attached to an Empty, which is then connected to the player prefab, if you separate them, you get a tonnnn of bugs popping up, in other words, the camera is hard-coded to always be attached to the player prefab.
The reason this is an issue for me, is Photon. Every guide I come across shows how to set this up, with the camera being a standalone thing. So, I'm not sure if this is even possible, cause I'm new to all this.
Here is how it's normally done:
GameObject playerObj = PhotonNetwork.Instantiate("PlayerPrefab", new Vector3(114f, 105f, -90f), Quaternion.identity, 0);
vp_FPCamera camera = playerObj.GetComponent<vp_FPCamera>();
camera.enabled = true;
So, my question is, is it possible to code something to look at a sub-object component, instead of the base level of the object?
I have PlayerPrefab > FPSCamera > vp_FPCamera script component. My current code above only looks at PlayerPrefab for 'vp_FPCamera'.
Any help here would be greatly appreciated. Thanks. :)
I'm also facing the same problem, any insight in a solution would be great :)
Answer by xt-xylophone · Jan 20, 2014 at 02:28 AM
You cannot get the vp_FPCamera from the playerObject, you need to get it from the camera child of that object.
If I remember off the top of my head, the Camera object of the PlayerPrefab is just called "Camera"?
So you could do this:
GameObject playerObj = PhotonNetwork.Instantiate("PlayerPrefab", new Vector3(114f, 105f, -90f), Quaternion.identity, 0);
vp_FPCamera camera = playerObj.FindChild("Camera").GetComponent<vp_FPCamera>();
camera.enabled = true;
Your answer
Follow this Question
Related Questions
Photon room name issue 0 Answers
[Solved] Camera issue - Do not see camera icon in scene 1 Answer
camera.RenderWithShader not working in 5.1.0f3 0 Answers
Weird issue with clamp on Rotation 1 Answer