1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  4. Unity 2017.1 is now released.
    Dismiss Notice
  5. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

UFPS : Ultimate FPS [ RELEASED ]

Discussion in 'Assets and Asset Store' started by VisionPunk, Mar 9, 2012.

Thread Status:
Not open for further replies.
  1. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    731
    looks great man, tack on a bunch of weapons and a reload system and youve got an fps kit on your hands man. also shift for run.
     
  2. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hello, this is actually done in the demo (only it uses rotation instead of position). Check out the a method called "SwitchWeapon" in DemoScript.cs. You may want to copy it into your code. What it does is it rotates the weapon out of view, sets a new weapon, and rotates the new weapon back in. It also makes sure you can't fire during the process. I saw this as a demo specific feature (wanted to keep the camera class very generic). But I think you are right; this functionality should probably be part of the camera class as a convenience feature, so it always works regardless of scene (main script).
     
  3. Prion Games

    Prion Games

    Joined:
    Jul 1, 2011
    Posts:
    1,509
    This will do great for our game, if i cannot get something similar done by our programmers I would not mind $30 spent.
     
  4. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @Eclision: Hey thanks. I put 664 hours into it (about 4-5 man months) so it should hopefully be a bit of a time saver for them ;)
     
  5. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    Just purchased this. I've dragged the FPSPlayer onto my scene and when I hit play I get a bunch of NullReferenceExceptions. I also get multiple weapons shown at once. Any idea's why this might happen?
     
  6. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hello dotty,

    Please email me the NullReferenceExceptions and I'll try to figure this out for you (in case you dont know how, open the console and click on each error to display the whole error text. Just copy and paste the full multi-line error text from each error into an email). The multiple weapons probably happen because of the exceptions.

    Thanks!

    /Cal
     
    Last edited: Sep 7, 2012
  7. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    245
    Same problems here. :(
     
  8. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Ok, unicat. Please feel free to email me your crashlogs too.

    /Cal
     
  9. lastprogrammer

    lastprogrammer

    Joined:
    Apr 30, 2011
    Posts:
    153
    I will check that out, thanks for the info. I also have altered the script so that your system is working on iOS. Your system is great, I never thought about using springs for movement before.
     
  10. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @thelastprogrammer: Cool. Just out of curiosity: what aspects of the code did you have to tweak to get it running on iOS?
     
  11. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    245
    Works now, Thank You.
     
  12. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Ok, great. To other people who may have experienced the NullReferenceException mentioned above:

    A crash can be caused by using the FPSPlayer prefab from 1.11 or earlier. This can happen since the FPSPlayer prefab used to be located in the root of the package, but the new FPSPlayer is in the "Prefabs" folder. In other words, the old one is not overwritten by installing v1.2.

    So please delete the FPSPlayer prefab in the asset root and instead use the one in the "Prefabs" folder.
     
  13. hxxhui

    hxxhui

    Joined:
    May 10, 2012
    Posts:
    9
    Hi, I have the "NullReferenceExceptions" and "multiple guns at the same time" problem here too. I just bought V1.2 2 days ago and did not import any early version before. Here is the error message:

    NullReferenceException: Object reference not set to an instance of an object
    vp_FPSShooter.Awake () (at Assets/UltimateFPSCamera/vp_FPSShooter.cs:94)
    NullReferenceException: Object reference not set to an instance of an object
    vp_FPSShooter.Awake () (at Assets/UltimateFPSCamera/vp_FPSShooter.cs:94)
    NullReferenceException: Object reference not set to an instance of an object
    vp_FPSShooter.Awake () (at Assets/UltimateFPSCamera/vp_FPSShooter.cs:94)

    it appears 3 times, each time for 1 weapon.

    Any idea about this?
     
  14. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hi, I'm looking into this now. I can't reproduce it myself, but another user had your exact same problem and he got it working by creating a new empty scene with a new ground plane and FPSPlayer prefab.

    I hope to solve this problem this weekend. What's your Unity version and operating system btw?

    /Cal
     
  15. hxxhui

    hxxhui

    Joined:
    May 10, 2012
    Posts:
    9
    My unity version is 3.5.1 and OS is windows xp

    It works fine in a new scene no matter this scene is newly built or imported. Some how when the problem appears, It can not work in this scene any more. I tried delete the FSP object from the scene and create a new one from the prefab, it doesn't work. I tried to reimport the FSP Package from asset store, it does't work. I also tried to create a new project and import the same scene in, it doesn't work too.

    To reproduce the problem, you could try broken the prefab connection in the scene. Before I meet the problem, I drag a solider object under FPSPlayer hierarchy, this object provide the soldier mesh and animation. The hierarchy just like this:
    -FPSPlayer
    solider
    FPSCamera
    ....
    Unity promote Prefab connection broken.
    When the problem come out, I delete solider obeject and recover the FPSPlayer to inital state, but the error always happen.

    Wish this could help you locate the problem.
     
  16. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Ok, big thanks. I'll look into this in the weekend.

    /Cal
     
  17. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    It's been a couple of days since the reply. Have you found out the problem yet?
     
  18. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    I'm looking into it as we speak ...
     
  19. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    I found another issue which is present in the FPSPlayer prefab and the FPSPlayer inside the SimpleScene scene. If you remove the pistol, the guns seem to get mixed up really bad. The machinegun fails to fire like a machinegun and also the shells it chucks out are huge.
     
  20. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Ok, dotty, could you maybe provide the following :

    1.) Email me the full Editor Log text file for your crash (not the one where you remove a weapon, but your previous nullreference exception crash). You can get the text file by clicking "Open Editor Log" in the top right corner of the console window.
    2.) Zip and email me a project folder where the error occurs. This does not have to be your game code or anything, just a simple project with a scene where you get the problem.

    Thanks

    /Cal
     
  21. filipilic

    filipilic

    Joined:
    May 12, 2012
    Posts:
    3
    I really love this, me and my friends are planing to buy this, just plain awesome and great work. (Y)
     
  22. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Just a headsup: some users have had problems with nullreference exceptions and a "multiple weapon bug". I've found the problem and will make a new release shortly. Thanks for your patience.

    Cheers

    /Cal
     
  23. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    Great news!
     
  24. tabor

    tabor

    Joined:
    Nov 29, 2011
    Posts:
    42
    Looking forward to the release to address the nullreference bug.

    Another problem I am having is that the changes I make to variables don't seem to stick when I hit play. (yes, i was not in play mode when making the changes)

    Any idea?
     
  25. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hello tabor,
    I assume you mean the "Persist Play Mode Changes" feature and are using it along with one of the demo scripts and / or the example FPSPlayer prefab? Heres a brief explanation (from the manual, p. 13):

    "The demo scripts in this package make heavy use of preset loading. This will mostly override the Persist system, giving the impression that it doesn't function. "Persist Play Mode Changes" works best in the initial design / testing stages of an app, when preset loading may not yet have been integrated into your scripts."

    Actually, I'm thinking of removing the "Persist Play Mode" feature since it doesn't work well with the preset system which is very confusing. It's meant as a small convenience feature but I find I'm never using it myself. Also, there is a much more fully featured asset doing the same thing: http://blog.almostlogical.com/2011/01/11/playmodepersist-unity-asset-store/

    /Cal
     
    Last edited: May 13, 2012
  26. lastprogrammer

    lastprogrammer

    Joined:
    Apr 30, 2011
    Posts:
    153
    I changed the way the input worked. You have it hard coded to where the controller and the camera scripts receive a Vector3 from the Mouse X and Y axis: Input.GetAxis("Mouse X"). This is of course completely incompatible with any mobile device.

    So, all I did was create a public variable name inputVector3, and I plugged it into the two scripts that need it, the controller and camera scripts.

    I then would receive finger position inputs from my users and translate that into the inputVector3 and plug it right into your scripts so that i achieve that same effect as if my users were using a mouse.

    Here is a video of my project:



    Do not get rid of the persist after play feature. I think it is a cool feature and I use it a lot.
     
  27. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,493
    This looks fantastic, but trying to incorporate C# behaviours into a sizable JS iOS project scares me to death.. Have you given any thought to offering a JS codebase or iOS native support in C#?

    Cheers
     
  28. filipilic

    filipilic

    Joined:
    May 12, 2012
    Posts:
    3
    How does this look on another person, for an example if we use this for a multiplayer game? Are the weapons moving or does that require animations? :)
     
  29. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    The weapons in the demo on page 1 aren't animated at all, the are just random moving to make them look like they are. It looks and works really well. However you can animate the your weapon models to make it look a lot better. As for multiplayer, all the models included are just an arm and weapon, there's no body. So i guess by default this solution might not work too well as a multiplier. However, it wouldn't be that hard to model and rig a character and place that behind the main camera. VisionPunk has done a great job with this, and his support has been amazing, quick replies and quick bug fixes. Without a doubt a great purchase for me.
     
  30. tabor

    tabor

    Joined:
    Nov 29, 2011
    Posts:
    42
    Thanks for your reply.

    But no, I mean any changes at all.

    On clicking play all values go to default. When using your prefabs and demo scenes, or creating my own with your prefab.
     
  31. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @tabor: This is most likely because both my demo scripts (including SimpleScript which is in the FPSPlayer prefab) will use heavy preset loading, overriding all manual changes. The example scripts are intended for demo purposes only. To prevent SimpleScript.cs from overriding your changes, you must edit the script and remove all instances of "m_Camera.Load", "m_Controller.Load", "m_Camera.CurrentWeapon.Load" and "m_Camera.CurrentShooter.Load". This will ofcourse change the bahviour of the script remarkably. You can also modify the text presets referred in the "Load" calls to reflect you desired behavior. Make your changes at runtime, save presets using the "Save" button and load them from script.

    @thelastprogrammer: Thats cool, it's the first time I've seen video from someone elses game using my asset :) Also cool that you're doing melee with regular animations on top (?). Thx for the iOS info bit. I'll think about the Persist feature. I have stopped marketing it for now since it's a bit confusing to people. Perhaps it could be made optional in some way.

    @filipilic: Dotty is right, there is nothing in this system for now that takes into account how the player will look in multiplayer. What you'll have to do for that case is to use an animated character model on the same gameobject as the FPSController script. For example a Mixamo model. http://www.mixamo.com/ Ofcourse this will require some basic scripting knowledge.
     
  32. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Version 1.21 of Ultimate FPS Camera can now be downloaded from Asset Store.
    This is purely a bugfix release:

    ● Fixed an issue with FPSShooter giving NullReferenceExceptions resulting in the FPSPlayer prefab working sporadically or not working at all in some circumstances.
    ● Fixed an issue where multiple weapons would be rendered inside each other.
    ● Fixed an issue where removing a weapon from the FPSPlayer would break the functionality of the other weapons.
    ● Improved zoom functionality in SimpleScript.cs.
    ● Fixed an issue in DemoScript.cs where the weapon layer would not be reset after leaving the 'Weapon Layer' demo screen with layer set to 'OFF'.

    Thanks to everyone who helped out reporting bugs and sending log files! Let me know if your problems stick around after installing this.

    Read the full Release Notes HERE
    Asset Store LINK

    Cheers

    /Cal
     
  33. hxxhui

    hxxhui

    Joined:
    May 10, 2012
    Posts:
    9
    already updated. Seems Ok now. Thanks for the great job.
     
  34. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,493
    Cheers
     
  35. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hey AaronC, oh I forgot to answer this! There won't be a JS version (sorry). A C# iOS compatible version is more likely. Not sure when though. You may want to talk to thelastprogrammer since he is pretty much the trailblazer of using Ultimate FPS Camera on iOS :)
     
  36. tabor

    tabor

    Joined:
    Nov 29, 2011
    Posts:
    42
    Tried what you said, I am still confused.

    So If I open your simple scene.
    Select FPSPlayer, click load, choose drunk controller (for example)
    Select FPSCamera, click load, choose drunk camera.
    I see the values change according to those presets.
    But then clicking play everything goes back to default.

    Is this how it is supposed to work?
     
  37. PhilippeV

    PhilippeV

    Joined:
    May 15, 2012
    Posts:
    2
    Hi, I just bought your Ultimate fps camera, and I think it's awesome ! great job !
    The demo is really attractive ! well done

    But I'm in the same situation than Tabor, I cant find a way to change any value and see it in the game (except by editing the script).
    Like he said, even when I'm trying to load one of your scripts (camera and controler) the "Modern" one is still in use when I launch the game. And the slider's value are back in there initial setting during the simulation.
    I thought it was customisable like in the Demo, without editing text.

    Still, I like your work a lot.

    thanks !
     
    Last edited: May 16, 2012
  38. hxxhui

    hxxhui

    Joined:
    May 10, 2012
    Posts:
    9
    Hi, Cal:

    I looked into the code try to find out the corrections. As I am a beginner of unity, I want to learn something from the correction. That would be quite helpful for my coding under unity later on. Following is my understanding of the correction place, I am not sure whether my understanding is correct:

    1) Noreference problem:
    New code make some changes to loose the prefab hierarchy structure. previous code "transform.parent.GetComponent " VS current code "transform.root.GetComponentInChildren". Is the tight bundled hierarchy by code cause the problem of Noreference?

    2) multiple weapon
    In function setweapon(), sometimes the "gameObject.SetActiveRecursively(false)" not take effect cause the problem?
    so you just deactive all children in the new code?

    If my understanding is wrong, please give me some advise. Thanks a lot. :)
     
  39. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    tabor and PhilippeV,

    I think I understand your problem. The FPSPlayer prefab overrides all your changes when you press play. This is intended, yes. It happens because the script attached to the controller inside it does load its own text file presets when you press play. In order to change this behavior. You need to either:

    1) Edit the SimpleScript.cs file so that it does not load any preset text files, or load the text files of your choice.
    ... or ...
    2) set up your own FPSPlayer from scratch with your own custom made player script (see instructions in the manual).

    ● However, I can definitely see why this is not very obvious. I have created a new "FPSPlayer2" prefab for you that does not load its own presets. Get it from here:
    http://www.visionpunk.com/misc/FPSPlayer2.unitypackage

    Once imported, there should be an "FPSPlayer2" in the "Prefabs" folder, and a new modified script "SimpleScript2.cs" in the UltimateFPSCamera root. Use the prefab instead of the regular one. It should allow you to make any changes to any component in the prefab, without them getting reset.

    I will probably modify the included prefab to use this behavior in the next version.

    Regards

    /Cal
     
    Last edited: May 16, 2012
  40. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hello hxxhui,

    The nullreference problem was related to execution order of the 'Awake' calls of the monobehaviours. The order in which Awake is called on Unity objects is not guaranteed to be the same for every created prefab. There was code in the camera that assumed the weapons and shooters had already run their Awake calls and this would make everything collapse under some circumstances.

    Curiously, it would work in some created prefabs an not in others. And ofcourse I never got the error myself :)

    1) Previously, I assumed the exact location of a component in the hierarchy. But since the system changes the hierarchy of the gameobjects during runtime, sometimes a component would be in the right place, sometimes not (depending on whether all Awake calls had been run yet). This would cause an object to end up null. The use of "transform.root.GetComponentInChildren" is safer under these circumstances than "transform.parent.GetComponent" because it starts looking for the component from the top of the hierarchy going down, ignoring its exact location.

    2) Put simply, yes. Also, the code in vp_FPSCamera.Awake now operates on the weapon components, and both that method and .SetWeapon also no longer rely on transform names. As i recall, there were problems with these not being reliable too, because of execution order of the Awake calls.

    Hope that sheds some light.
     
    Last edited: May 16, 2012
  41. hxxhui

    hxxhui

    Joined:
    May 10, 2012
    Posts:
    9
    Got it. Thank you soo...o much.
     
  42. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,493
    Made a purchase, would be keen to see a two handed rifle implemented system implemented at some stage?
    Great work and thanks

    AaronC
     
  43. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    You should be able to drop in a rifle model (and muzzleFlash, Shell and bulletDecal) into the FPSPlayer prefab and attach the FPSWeapon script and tweak the values to make it work. I made a simple replacement pistol model and managed to import it into FPSCamera just fine.
     
  44. kevdotbadger

    kevdotbadger

    Joined:
    Sep 13, 2011
    Posts:
    82
    Another quick thing, I noticed that the bullets don't have any rigidbodies attached, so at first it was difficult to determine what object was hit (and react to that). However, all the raycasting is done on line 55 of wp_bullet.cs. The hit variable contains the object hit. Using this you can easily call a method on the hit object.
     
  45. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,493
    yea I mean some kind of IK system or similar spring system for 2 hands, as you never really operate rifles single handedly

    ~A
     
  46. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    @AaronC: For a two handed weapon such as an AK47 or a two-handed axe, I suggest building both arms into the same model. I think it would actually look great as a single weapon moved in unison by the sway physics, especially if the model had nice reload animations like this one: http://www.youtube.com/watch?v=m4F8eJKle3E

    @dotty: Big thanks for helping out answering questions in the forum :)
     
  47. PhilippeV

    PhilippeV

    Joined:
    May 15, 2012
    Posts:
    2
    Wooo man ! thx a lot !! I couldn't expected more !!! it's working perfectly now. and it's making the tweaking easier, for a non-coder like me !
    If everything can be changed like in the demo, from the Unity's inspector, rather than editing scripts, your product will be the perfect one !!!

    Thanks !!!
     
  48. tabor

    tabor

    Joined:
    Nov 29, 2011
    Posts:
    42
    Hey VisionPunk, I appreciate all the support you have been providing. Still not working for me tho.

    Import your newest package.
    Import your FPSplayer2 package.
    Create a new scene, add a plane and a light, and drop in your FPSPlayer2 prefab. Using simple script 2.
    Change settings, hit play, back to default.
    Change setting, save preset, hit play, back to default.
    So strange!

    My workaround for now it creating an animation that changes the values quickly on play.

    If you have any other ideas I'd love to hear them.

    Thanks again.
     
  49. VisionPunk

    VisionPunk

    Joined:
    Mar 9, 2012
    Posts:
    711
    Hmm, yes this is very strange. I think I need to have a look at your setup in order to debug this. If you could provide the following it would really help:

    1. Please create a bare bones project and scene (like the one you described) where your problem occurs.
    2. Zip the project folder (or export it as a unity package) and email it to me

    Thanks

    /Cal
     
    Last edited: Sep 7, 2012
  50. nielo

    nielo

    Joined:
    May 13, 2012
    Posts:
    10
    First, thanks for a great asset!

    For some reason my first weapon still works but my weapon switching has stopped working and all my weapons remain visible - has anyone come across this behavior before? Hoping I'm missing something small.

    The other thing I'd like to do that I'm hoping to get some advice on is that I need to have a flashlight in the left hand for single handed weapons and I was hoping there was an easy way to do that. I need to have the weapons and the flashlight as seperate game objects.

    Oh, if anyone's interested I created a component for muzzleflash that allows attaching a light. In other words when you fire a shot there's a flash of light brightening your surroundings as well.

    Cal; I can send it to you if you wish to review it first (either to check I'm not exposing your code or perhaps to integrate it into your project).

    I've also changed my vp_FPSShooter class to allow for attaching multiple sounds. Oh yeah - I also had to change vp_FPSShooter so it executes BroadcastMessage("shoot") instead of calling the shoot function in order to allow for the muzzleflash component I created to work with UFPS.

    I would have preferred to inherit and override behavior rather than changing the core code - perhaps in your next version you can change your private properties to protected properties so that inherited classes can access those properties?
     
    Last edited: May 18, 2012
Thread Status:
Not open for further replies.