Forum rules - please read before posting.

Cursor locked in the center when it comes to SubMenu

edited December 2014 in Technical Q&A
I'm integrating with UFPS, and I'm thinking how do I lock cursor in the middle to avoid the cursor going out the game, then I figured it out by uncheck "Forced (always show)" in Vp_FPInput. One thing is when I go to menu, the cursor worked perfectly (what I mean is the cursor is free), and then when I click options (or any other sub-menu) the cursor doesn't move from center, it locked, but when you go back to main menu, the cursor is free, it doesn't lock in the center. There's bug in sub-menu. Can you fix this?

Comments

  • Does your sub-menu pause the game or not?  If it doesn't, but the main menu does, this would be the expected behaviour.  Lock your sub-menus and try again.

    If not, try using the Player: Constrain Action - you can use that to disable free-aiming (and hence unlock the cursor) whenever you want 
  • @ChrisIceBox My sub-menu did paused the game, okay, thanks, I'll try that soon
  • edited January 2015
    I'm also experiencing the same problem. The cursor only gets locked in the center in sub-menus, not in the main menu. Strangely enough, It completely disappears in the sub-menu.

    I tried doing the  Player: Constrain Action trick and that did not seem to help. Perhaps I am doing it wrong. I placed the action to run when starting a menu like this. 

    Here is the direct link http://i.imgur.com/OKYq1I1.png

    image
  • @mayhem4masses: Are you using 1.41a?  There's also a Console error being reported there - what's the message?
  • I am using version 1.41a 

    These are the two errors I get:

    Error: (AdvancedPlayer-AC (vp_FPWeaponHandler)) Hierarchy error. This component must be added to a gameobject with vp_Weapon components in child gameobjects.
    UnityEngine.Debug:LogError(Object)
    vp_WeaponHandler:GetWeaponList(Transform) (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_WeaponHandler.cs:203)
    vp_WeaponHandler:InitWeaponLists() (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_WeaponHandler.cs:112)
    vp_WeaponHandler:get_Weapons() (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_WeaponHandler.cs:47)
    vp_WeaponHandler:Awake() (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_WeaponHandler.cs:95)

    PlayerPrefs loaded.
    UnityEngine.Debug:Log(Object)
    AC.Options:LoadPrefs() (at Assets/AdventureCreator/Scripts/Options/Options.cs:67)
    AC.Options:Awake() (at Assets/AdventureCreator/Scripts/Options/Options.cs:32)
    UnityEngine.Object:Instantiate(Object)
    AC.KickStarter:Awake() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:694)

    Thanks!

  • The argument out of range error in the picture was unrelated and I fixed that. It had to do with something UFPS forgot to remove in their last update.
  • If the Options menu pauses the game you should be able to move the cursor around just fine.  The "Player: Constrain" Action is not necessary - that was only for menus that don't pause gameplay.

    Of the two console logs you've shown - the second isn't an error, just information.  The first is related to UFPS.  It's not possible for me to say if that's related, but if you temporarily set your game to Point And Click movement, we can see if that stops the error from occuring.  If it does, see if following the instructions in the UFPS error solves the problem.
  • edited February 2015
    Hello there,

    I have the same problem, the error in the log

    Error: (AdvancedPlayer (vp_FPWeaponHandler)) Hierarchy error. This component must be added to a gameobject with vp_Weapon components in child gameobjects.
    UnityEngine.Debug:LogError(Object)
    vp_WeaponHandler:GetWeaponList(Transform) (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_WeaponHandler.cs:205)
    vp_WeaponHandler:InitWeaponLists() (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_WeaponHandler.cs:114)
    vp_WeaponHandler:get_Weapons() (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_WeaponHandler.cs:47)
    vp_WeaponHandler:Awake() (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_WeaponHandler.cs:97)



    That`s strange, because it refers to vp_weapon, but I thought that component is for the third person mode.

    I`ve tried both methods, using the advanced player prefab from ufps, and the advanced player prefab from the AC-page, and it`s the same.

    The Cursor is locked in the middle of the screen when I am in submenus, or when I toggle to cursor mode via the ToggleCursor button. Although the cursor is locked almost, you can move it a little.

    Help!

    PS: Why is the Advanced Player prefab from the AC-downloads equipted with the weapon camera, while the ufps-tutorial says it should be deleted.
  • Please wait for the 1.42 release (should be out this week) - it fixes some issues related to cursor-locking, and may fix this problem.
  • Chris,

    I still get the "Hierarchy error" too. I'm using UFPS 1.4.9, AC 1.4.2c, and the AdvancedPlayer prefab.

    vp_WeaponHandler.cs looks for vp_Weapon components on Camera.main. 

    The problem is that the AC / UFPS tutorial says to change UFPS's FPSCamera tag to FirstPersonCamera. So vp_WeaponHandler ends up searching AC's _Camera/MainCamera instead.

    Any workaround?
  • edited March 2015
    It may have to be that AC will need to alter the tags in-game.  I will look into it.
  • edited March 2015
    I forgot to mention that I'm also using Unity 5.0.0f4.
  • Chris - I'm still getting this in AC 1.43.
  • Have you upgraded your UFPS player?  The steps to convert a UFPS prefab to AC have been greatly simplified, but you will need to modify old ones.  This tutorial covers the steps.

    Also, the downloadable UFPS/AC player prefabs have been updated to work with v1.43.
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.