Forum rules - please read before posting.

AC + UFPS sound issues and old errors

edited October 2015 in Technical Q&A
Hello. Trying to get Adventure Creator to work with UFPS. I am new to both systems. To the best of my knowledge, I am using the latest versions of both assets (AC 1.48b & UFPS 1.5.1) I am using Unity 5.2.1p4. Here are the issues:

1. Errors

-If I follow the instructions exactly as they are laid out here except with the Hero ufps prefab: http://www.adventurecreator.org/tutorials/integrating-ultimate-fps I get the following error:

Error: (Hero AC(Clone) (vp_FPWeaponHandler)) Hierarchy error. This component must be added to a gameobject with vp_Weapon components in child gameobjects.

From my searching, I have seen that a whole lot of people have this problem, but have yet to see a solution that works. In fact, has anyone actually ever gotten AC to work with UFPS without errors?

In any case, if I add my "Hero AC" prefab to the scene before the game starts and retag the FPSCamera to MainCamera and retag MainCamera to untagged, I get the following error: MainCamera has no MainCamera component.

I'm not including the full text of these errors simply because I'm sure you're already familiar with them. In both cases, the game appears to still work, although in the first case, the animations for shooting in UFPS's third person view is screwed up, but this doesn't happen in the second case. I have read in another thread that it is pretty safe to just ignore "the MainCamera has no MainCamera component" error, but I am posting this to make sure there haven't been any development s since that thread. If the solution is still to ignore this error, then so be it for now. If there is a fix now known, I'd like to know it just because I hate errors :-)

2. No sound until the menu is brought up.

When the game starts, there is no sound. There continues to be no sound until I bring up the esc menu and then choose resume. Upon choosing resume to dismiss the menu, the sounds that were supposed to have played before play at that time. From that point on, all sounds play as they are supposed to.

I have found no info on how to fix this one.

Both of these issues also arise when using the "Advanced Player" AC prefab that is provided by Adventure Creator.

Thanks,
vance

Comments

  • Welcome to the forum, vance.

    1) I believe you have the MainCamera tagging the wrong way around.  If the prefab is in the scene before the game starts, then the player camera must be untagged.

    If the prefab is loaded in at runtime, then the player camera should be tagged as "MainCamera".  In both cases, AC's MainCamera should remain tagged as "MainCamera".

    2) I have the same issue, but it's not clear to me why this is the case.  However, I do find that the issue does not occur if the player prefab is in the scene before the game runs.  Try tagging the components as suggested above, and see if things improve.
  • Hello and thanks. Here what I have now discovered.

    1) In all the following cases, AC's MainCamera is tagged as "MainCamera"

    a) If I tag the player camera as untagged and add the player prefab before the game begins, I get the Hierarchy error and the animation problem

    b) If I tag the player camera as "MainCamera" and load the player prefab at runtime, I get the hierarchy error and the animation problem.

    c) If I tag the player camera as "MainCamera" and add the player prefab before the game begins, I get the "mainCamera has no Maincamera component" error, but everything seems to work so far although I'm not that far into the development so it might cause problems later?

    2) I have more useful information on the sound problem! If The pause menu is being displayed when the game is terminated, the sound issue will persist until the pause menu is brought up again and resume is pressed. This always happens when selecting "Quit" from the pause menu of course because in order to select that option, the pause menu must be up. It also happens if I bring the pause menu up and then use the Unity Editor to end the game.

    However, if the sound is working and I end the game with the Unity Editor without bringing the pause menu first, the sound works the next time I start the game.

    Therefore, the pause menu is doing some kind of universal "stop sounds" thing when it is displayed that even carries over into the next start of the game and continues until the pause menu is brought up again and Resume is chosen so that sounds are restarted.
  • edited October 2015
    As I suspected, the sound issue is not present across restarts in the built version, only when running it within Unity. Unity is probably running the game in the same process and the pause menu is stopping sound on the whole process until being restarted. Or something....

    So I guess that makes the sound thing more of a "nice to have" fix rather than something crucial, although it can be disconcerting for people who don't know what's going on.

    By the way, the sound issue does still happen under the conditions described above regardless of whether the player prefab is added at runtime or before the game.
  • I haven't encountered such animation issues, but from the sounds of it you're going for a more advanced prefab.  The MainCamera component error sounds like the least serious of the bunch, so go with that for now.  If problems arise later, you can of course post them here.

  • edited November 2015
    @hightreason - I had some of these issues with UFPS and AC. I'm not doing exactly what you're doing, but here's what I recently did to get around the issues if it's any help.

    1. Set up everything according to Chris's tutorial. Used an AdvancedPlayer.

    2. Deactivated the MainCamera GameObject (and actually deleted it later).

    3. I added the MainCamera script and a GUILayer to the AdvancedPlayer's FPSCamera. I moved the original MainCamera's LookAt child to be a child of FPSCamera. [Note: MainCamera reports the warning "MainCamera is parented to an unknown object.... it may cause mis-alignment when... attached to a GameCamera." We're not using GameCameras because the game supports Oculus, and we want the player to have full look control at all times.]

    4. The MainCamera script disables the FPSCamera's Camera component on Start. I added a small script to re-enable it after one frame.

    Everything seems to work so far, but I only recently set it up like this. Previously, I was having a problem that Unity would grab the original MainCamera for VR mode. But, right after, AC would disable MainCamera's Camera and enable FPSCamera. This was a workaround to make sure Unity correctly grabs FPSCamera for VR mode.
  • @PixelCrushers: Have you tried replacing the MainCamera prefab with the MainCameraVR prefab in /AdventureCreator/Prefabs/Camera?  That prefab places the actual Camera component on a child object, so that it can be controlled by the player without affecting the MainCamera parent.

    The ideal workflow would be that you can have both the MainCameraVR and the UFPS camera in the scene together, so that you can either give the player full control, or cut to other cameras, without having to change the core setup of the scene.
  • @ChrisIceBox - I'll take a look at that and let you know how it works out. Thanks!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.