Forum rules - please read before posting.

UFPS all guns on at start

edited April 2015 in Technical Q&A
When I start my game all my UFPS guns are visually on, so Im holding tons of weapons. They dont actually work though, neither does picking up weapons. If I turn off AC and use the same guy things work as expected. 

Is there some trick I must do to have them weapons not turning on like this ?

I receive these errors which I assume are related:

Error: (HeroGAZV11(Clone) (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:224)
vp_WeaponHandler:InitWeaponLists() (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_WeaponHandler.cs:133)
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:116)
UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)
AC.KickStarter:ResetPlayer(Player, Int32, Boolean, Quaternion) (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:639)
AC.KickStarter:Awake() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:741)


NullReferenceException: Object reference not set to an instance of an object
vp_Component.DeactivateWhenSilent () (at Assets/UFPS/Base/Scripts/Core/ComponentSystem/vp_Component.cs:645)
vp_Component.ActivateGameObject (Boolean setActive) (at Assets/UFPS/Base/Scripts/Core/ComponentSystem/vp_Component.cs:354)
vp_WeaponHandler.DeactivateAll (System.Collections.Generic.List`1 weaponList) (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_WeaponHandler.cs:349)
vp_WeaponHandler.InitWeaponLists () (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_WeaponHandler.cs:163)
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:116)
UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)
AC.KickStarter:ResetPlayer(Player, Int32, Boolean, Quaternion) (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:639)
AC.KickStarter:Awake() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:741)


Cheers,
Gaz

Comments

  • I discovered something weird, if I leave my player on in the hierarchy, when I run AC it works as expected. Usually I turn my player off and let AC insert the one I have defined, but this causes the issues above, I suspect something to do with cloning, I dont know. Im confused why it works, I would have thought there would be 2 copies of my player, but theres not, and the one i leave on can use AC features etc like hotspots. So this is an actual solution, but maybe you can explain Chris why theres not 2 players in the level ?

    I think a fair few of the recent UFPS issues ive seen could be revolved by not letting AC clone the prefab and just by keeping him already on, I assume you have adjusted it so if he already exists it doesnt make a new one, as i dont recall this behaviour? 
  • edited April 2015
    Now that I can get that all working Im back to some old stuff.

    I still have issues with the gun continually firing (which stops when u hit right mouse button and ONLY happens if you hold fire down slightly too long) and melee weapons dont swing (mace or the new uber cool knife!), yet grenades work fine (love them). I believe that there must be some sort of wrapper where you pass on the keypresses or something to UFPS, or something similar, and this bit is just slightly off. Thats pure guess work but I will go looking.. otherwise Im inching closer and closer to a fully wonderfully working ufps/ac game. It makes me super excited! 
  • If you have a player prefab present in the scene before the game runs, then AC will let that one "override" the prefab setting for that scene only.

    The issue in your first post seems to be to do with the "MainCamera" tag, and the object that has it when the game runs.  You should be able to get around the issue by untagging the MainCamera object, tagging your player prefab's FPS camera as "MainCamera" instead, and ignoring the warning message that AC throws up when the game begins.

    The strange thing about the continuous firing is that no - there is no wrapper for keypresses, and the two assets should be completely independent in that regard, so there shouldn't be any kind of conflict at all.  I also haven't been able to recreate this problem myself.  One thing you might be able to try is setting the game's Input method to "Keyboard Or Controller" - this would effectively tell AC to ignore mouse clicks altogether.  That wouldn't be the solution, of course, but it would at least help us narrow the source of this down.
  • edited May 2015
    When it came to the 'all guns on start', I found that untagging the Main Camera in the scene and tagging the one on FPSCamera in the player prefab worked for me, but I then hit the firing issue when I tried to move the camera in-game.

    To fix it, in Game Editor > Settings I set Movement to Ultimate FPS, Input method to Mouse And Keyboard and (the bit that made the difference and fixed it for me) I've checked Lock cursor in screen's centre when game begins.

    If I have Lock cursor set to false, the only way to move the camera is to hold down the mouse button and pan around, but Ultimate FPS assumes you won't be doing drag and drop camera so starts firing and going a bit mad.

    Hope this fixes it for anyone else with similar problems.
  • Thanks for the tip, @PsychicParrot!
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.