Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Realistic FPS Prefab [RELEASED]

Discussion in 'Assets and Asset Store' started by Deleted User, Apr 5, 2013.

  1. thenamesace

    thenamesace

    Joined:
    Jan 25, 2014
    Posts:
    157
     
  2. noori-mehammad

    noori-mehammad

    Joined:
    Oct 27, 2012
    Posts:
    10
    thank you so much
    Can I call you that when I am experiencing difficulty in the development of this project
     
  3. noori-mehammad

    noori-mehammad

    Joined:
    Oct 27, 2012
    Posts:
    10
  4. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi, in the new demo after each wave it slows down time automatically, How can I add this? Thanx Jimbob

    Edit!
    For anyone who wants to know How to, I managed to make it work
    Code (CSharp):
    1. Add these two to the top;
    2. private FPSPlayer player;
    3. public float SlowtimeTime = 1.00f;
    4.  
    5. Add this to Start()
    6. player = Camera.main.GetComponent<CameraKick>().playerObj.GetComponent<FPSPlayer>();
    7.  
    8. Add this to around line 145
    9.  
    10. ....if(waveEndFx && !fxPlayed2){
    11.                 fxPlayed2 = true;
    12.                 playerAudio.PlayOneShot(waveEndFx, 1.0f);
    13.                 player.bulletTimeActive = true;
    14.                 yield return new WaitForSeconds(SlowtimeTime);
    15.                 player.bulletTimeActive = false;
     
    Last edited: Mar 15, 2016
  5. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    how can i use it with Paragon Shooter AI or Tactical shooter AI?

    Or how can I add cover finding for it's AI?

    and Also its not working with 5.3.3 !
    when I add a FPS Perfab to an empty terrain , the camera has some "fish eye" effect! the scene is curved!

    sorry for my English
     
  6. Deleted User

    Deleted User

    Guest

    Nice additions and thank you for bringing this up Deppex, this has been fixed in the next version, but if you want to apply the fixes now, just add QueryTriggerInteraction.Ignore at the end of the Physics.CheckCapsule calls in FPSRigidBodyWalker.cs. There are about 6 or seven of them around line 400. So a call that will ignore trigger volumes and allow the player to stand up in one will look like this:

    Code (CSharp):
    1. if(!Physics.CheckCapsule(p1, p3, capsuleCheckRadius, clipMask.value, QueryTriggerInteraction.Ignore)){

    By default, the WaterZone.cs script attached to the water trigger object changes the fog and light settings of the scene, you can change this by unchecking the Change Sunlight Color, Underwater Light Enabled, and Underwater Fog boxes of Waterzone.cs. @BHS also made this video for Unistorm:




    Hi rbm123, I'll have a look at this. You should be able to use any AI system you'd like, the main thing you will need to do to integrate the AI with the Realistic FPS Prefab is to find where the AI detects their goal or target and set that reference to the RFPSP's player object, then to make the AI NPCs be damaged by weapons, an additional check in the HitObject( ) method in WeaponBehavior.cs can be added to pass the damage amount to the NPC. To have the NPCs damage the player, their attack script can be modified to call the ApplyDamage() method of FPSPlayer.cs when their attack hits the player. Hope that helps. You can send us an email too if you have any more questions.


    As for a status update on the next version, bow and arrow weapons have been implemented! There were some things that needed to be figured out for the arrow system, but everything should be working now. Here is the preview web player demo you can try. Some notes on the new additions:
    • Hold the fire button to charge the arrow shot, a shot is fully charged when the bow model stops pulling back slightly (takes around 1.5 seconds, and can be customized).
    • Shot power is tied to arrow velocity and damage. Both these values can be modified in the inspector if needed.
    • Arrows stick into most surfaces and can be retrieved by pressing the use key over them.
    • Pressing V will preform an offhand melee attack with the bow.
    • The bow was rigged with the bowstring as a separate mesh, so the bow and arrow model could be easily swapped with different ones in the editor, without needing to reanimate the bowstring, arrow, and hands.
    • Sword and shield weapon also added. The zoom key blocks with the shield and can defend from projectiles as well as maintaining guard after a block, unlike parrying with melee weapons.
    • Shield bash by pressing V.
    • Head shot slow motion chance and damage multiplier are customizable for game balance. Values in the demo might be a bit high/OP for an actual game, but are good for testing.
    All the planned features for the next version are now finished, so it's a matter of updating the docs and doing some final testing. Should be finished this month. Thanks for your patience.
     
    Last edited by a moderator: Mar 18, 2016
  7. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    YEAH !!!!! :D

    Good news of the day ! Thanks Azu ^^
     
  8. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    Today I'll be releasing my horror game Shadows Peak on steam early access. Shadows Peak is using RFPS 1.21 as a basis for character movement, inventory etc.

    Take a look if you're interested. http://store.steampowered.com/app/359940/

     
  9. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Holy Sheet! Amazing work with the Arrow and Sword n Shield systems. :D
     
    Deleted User likes this.
  10. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    please work on AI and add find cover and cover and shot ability to NPCs! this will make people pray for you!
     
  11. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    great update I really like it.
    can you add one thing more.
    like when player move or fire than the Aim pointer
    expand when not it come to its original size (Shrink)
     
  12. Legorobotdude

    Legorobotdude

    Joined:
    Feb 19, 2016
    Posts:
    41
    I have some suggestions for the future.

    The first would be a one in the chamber system, which basically means unless you reload after emptying every bullet from your magazine, you will have 1 extra bullet that was stuck in the chamber while you took out the old mag and put the new one.

    The second is a accessory interaction/inventory system of sorts. This mostly comes into play in VR, though its cool in normal 3d as well. Basically what this means is when you change the fire mode, the fire mode selector moves. In VR, you would flip the fire selector and that would change the fire mode. It would also allow scopes and sights to be attached to rails, along with flashlights and laser sights. (In VR you physically stick them on, but in flat 3d you do it via a customization menu)

    Anyone have any ideas on how to start coding this? I would be willing to give it a shot.
     
  13. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Hello how to add a lamp to my character please ? thank you
     
  14. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    130
    add a small light to your character! then active with pressing button!
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,657
    Or create a new weapon that's a flashlight. Add a Spot Light to the flashlight weapon model. See Gua's Shadows Peak (see above) for an example of this technique.
     
  16. canaljuegos32

    canaljuegos32

    Joined:
    Jun 29, 2015
    Posts:
    63
    Yeah add a weapon, I did with a torch:
     
    Deleted User, llJIMBOBll and TonyLi like this.
  17. Legorobotdude

    Legorobotdude

    Joined:
    Feb 19, 2016
    Posts:
    41
    Anyone have any tips on animating hands and animations?

    The placeholder hands are pretty basic, so I've been looking around for a replacement, but I have no idea how to animate something like that. Any tutorials anywhere?
     
  18. QuadMan

    QuadMan

    Joined:
    Apr 9, 2014
    Posts:
    122
    Find Blender or 3DS Max tutorial, or animate on unity.
     
    Legorobotdude likes this.
  19. TalhaDX

    TalhaDX

    Joined:
    Feb 2, 2013
    Posts:
    94
    When we import package for the first time and build for mobile, screen touch fires a shot. I am using Control freak for my inputs, now touching left middle part of the screen fires a bullet. And i can't find where the bullet is being fired. I have tried disabling Control freak, but it still shots.

    Confusing. Any idea
     
    Legorobotdude likes this.
  20. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi all !

    I have a problem with RFPS and a new "Impact & muzzle flash" system.
    I use THIS.

    The problem :

    RFPS use ParticleEmitter and Impact & muzzle use ParticleSystem :s

    How i can fix that ? :/

    Thanks
     
    llJIMBOBll likes this.
  21. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi I got the same pack, all I done was changed the code to ParticleSystem and instead of emit, use Play(); Same for muzzle flashes too, and just attach the new prefabs to your muzzle flash component and disable the mesh render on the old flash. It's a great kit, just need to fine tune it to make it work, like for the water you may need to rotate for the splash to go up instead of sideways.

    Set the effects to world space and play on awake off, a few like ripple effects needs local
     
    Defcon44 likes this.
  22. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Ok thank you JIMBo ! :D

    I go back to you if i have a problem with this, thanks ;)
     
  23. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Hello how to integrate the backup system / charging Easy Save for RFPS? thank you
     
  24. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    Really nice progress @Azuline Studios ! got a question!
    its possible to use arrow system for guns ? like bullet drop or velocity instead of hitscan ?
     
  25. Legorobotdude

    Legorobotdude

    Joined:
    Feb 19, 2016
    Posts:
    41

    Finally figured it out, go to input settings, and for fire, remove the binding for mouse 0.
     
    leandrovtd and TalhaDX like this.
  26. TalhaDX

    TalhaDX

    Joined:
    Feb 2, 2013
    Posts:
    94
    I removed Mouse 0 from "Positive Button" but the problem continues.

    Here's a screenshot of Input Manager: LINK
     
  27. Legorobotdude

    Legorobotdude

    Joined:
    Feb 19, 2016
    Posts:
    41
    Thats weird, because changing that did the trick for me.

    Anyways, heres a screenshot of my upcoming game:
     
    TalhaDX likes this.
  28. TalhaDX

    TalhaDX

    Joined:
    Feb 2, 2013
    Posts:
    94
    Yes weirdness continues...

    PS: Trees are too much cartoonic, is the game as well?
     
  29. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    I have my arrows and Rockets as projectiles, I used the ''Tracers'' to shoot them :D

    All I done was in Weapon Behaviour add a new Tracer bool
    Code (CSharp):
    1. public bool useTracersArrow = false;
    Add some Transforms
    Code (CSharp):
    1. public Transform rocket;
    2.     public Transform projectile;
    3.     public Transform projectilePos;
    4.     public float rpgTime = 1.00f;
    At around line 1123 add this
    Code (CSharp):
    1. if(useTracersArrow){
    2.                         //Emit tracers for fired bullet
    3.                         WeaponEffectsComponent.BulletTracersArrow(direction, muzzleFlash);
    4.                         rocket.gameObject.SetActive (false);
    5.                         Instantiate(projectile, projectilePos.transform.position,projectilePos.transform.rotation);
    6.                     }
    At around line 1322 add this
    Code (CSharp):
    1. ........................
    2. burstState = false;
    3.                     burstShotsFired = 0;
    4.  
    5. //NEW CODE PART START
    6.                     yield return new WaitForSeconds(rpgTime);
    7.                     rocket.gameObject.SetActive (true);
    8. //NEW CODE PART END
    9. .........................
    10.                     //do not wait for reloadTime if this is not a magazine reload and this is the first bullet/shell to be loaded,
    11.                     //otherwise, adding of ammo and finishing reload will wait for reloadTime while animation and sound plays
    12.                     if((bulletsToReload != bulletsPerClip && bulletsReloaded > 0) || bulletsToReload == bulletsPerClip){
    13.                         // Wait for reload time first, then proceed
    14.                         yield return new WaitForSeconds(reloadTime);
    15.                     }
    Then in Weapon Effects!!!!
    Add this to top
    Code (CSharp):
    1. public ParticleEmitter tracerParticlesArrow;
    Add this around 538
    Code (CSharp):
    1. public void BulletTracersArrow (Vector3 direction, Transform MuzzleFlashTransform)
    2.     {
    3.         //Draw Bullet Tracers
    4.         if (!FPSWalkerComponent.holdingBreath) {
    5.             if (tracerParticlesArrow) {
    6.                 //Set tracer origin to a small amount forward of the end of gun barrel (muzzle flash position)
    7.                 tracerParticlesArrow.transform.position = MuzzleFlashTransform.position + MuzzleFlashTransform.forward * tracerDist;
    8.                 //add shotSpray/accuracy value to straight-forward rotation to make tracers follow raycast to hit position
    9.                 tracerParticlesArrow.transform.rotation = Quaternion.FromToRotation (Vector3.forward, direction);
    10.                 //emit tracer particle for every shot fired
    11.                 tracerParticlesArrow.Emit ();
    12.  
    13.  
    14.             }
    15.         } else {
    16.             if (bubbleParticles) {
    17.                 bubbleParticles.transform.position = MuzzleFlashTransform.position - MuzzleFlashTransform.forward * tracerDistSwim;
    18.                 bubbleParticles.transform.rotation = Quaternion.FromToRotation (Vector3.forward, direction);
    19.                 bubbleParticles.Emit ();
    20.             }
    21.         }    
    22.     }
    Then on your weapon select 'Use Tracers Arrow' and unselect any other 'Use Tracers'.
    Still on the weapon at the bottom, the Rocket is the stick or arrow which is used for the weapon animation which after fired will hide so the reload animation can play and then after 1.25 secs for mine will re-enable it.
    The projectile is the arrow that gets instantiated. And the Projectile Pos is where is shoot out from, I set mine to line up with barrelsmoke pos and then about 0.6 - 1 away from it as it was sometimes clipping if I looked down to fire.

    Now on the projectile you just add the Damage part and speed of projectile, I used OnCollision Enter.

    Hope this Helps :D

    Its not the best arrow system but works, and can be used to fire rockets and grenades or watever :D Cant wait for new update, that arrow system is very good :D
     
    Last edited: Mar 30, 2016
  30. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    im pretty noob at coding(but i understand what u said) im mostly visual designer in my project.
    Your modifications looks nice but like you said, it has some problems with too close objects like ground and walls.
    its also nice to see you put efforts to write this and help the community :p
    Thanks!
     
    llJIMBOBll likes this.
  31. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    This is probably related to image effects. I had some weird issues with vignette and a few other effects on 5.3.3
     
  32. Legorobotdude

    Legorobotdude

    Joined:
    Feb 19, 2016
    Posts:
    41
    Yeah, the entire game is in the low poly style, except for the character and zombies.
     
  33. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi guy's !

    I have a problem with Fire & Reload Animation for pistol.

    i have rework two animations (this PACK), all works good with the animation windows but in game, none animation play.

    My weapon hierarchy* :



    Console error code (after shot or reload in game) :




    *My "G17_Anim" is the Weapon GameObject (no mesh on it just animation component) because if i create an empty game object with an Animation component my animation don't work (animation don't found the bones)

    Layer = Gun for all.

    I don't know were is my problem :/

    Any idea please ?

    Thanks
     
  34. QuadMan

    QuadMan

    Joined:
    Apr 9, 2014
    Posts:
    122
    Did you added animation component?
    Also, did you set it on WeaponBehavior?
    And animation set on Legacy?
     
  35. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Animation Component & WeaponBehavior = Yes (i use RFPS Since one for a long time moment now ;) )

    Legacy Animation = Yes (i have check after read you'r post, i have activate the "debug" mode and the animation clips and i have check the "legacy" case.

    Now, the reload animation works good but the fire animation don't want to play :/
     
  36. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Problem is resolve :)

    Just a problem with my animation ^^

    Thanks anyway :p
     
  37. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Hi, me ... again ^^

    So, today the RFPS problem is : NavMesh

    On two levels (wave spawner levels) i have this problem, on the first the AI spawn good, move, attack, die good but when i press "esc" (my pause menu) that create a BIG LAGGY levels (60 fps --> 20 FPS --> 3 FPS), i have test when the AI are not spawned the pause menu works perfect.

    And on the second levels : On 3 spawned AI only 1 by spawn walk and attack, the other don't move.

    I have make a new bake of navmesh, same problem.
    I don't touche the AI scripts.

    I got 2 error messages :

    Any idea please ?
    :s

    Thank you
     
  38. TryHarder

    TryHarder

    Joined:
    Jan 1, 2013
    Posts:
    121
    Hello,

    Has anyone actually implemented this on a mobile device, if so which controls did you use. I've been using easy touch, but two problems have baffled me.

    Firstly whenever I touch the mobile screen the camera flys up it it doesnt respect the touch pad. And two I cant make the player walk, I can move the character but not walk. I've implemented a gamepad no problem but trying to get touch controls to work has lead to hair loss!! :)

    Sooooo has anyone used this on a mobile device ?

    Thank you !
     
  39. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Some news on the update ?
     
  40. Deleted User

    Deleted User

    Guest

    This is an interesting idea rbm123, and could be integrated in a later version of the project. Thanks for your feedback.


    Thanks Dawar, expanding crosshairs are also on the list for a future version, and can be done either scaling up the crosshair image, or dividing it into four separate images/overlays and expanding their positions to represent shot spread/accuracy.


    Tactical reloads/chambering is definitely something that would increase realism, Legorobotdude. It would involve some script and animation changes which could make it into a future update as well.

    Your accessory interaction idea sounds interesting. I've always wanted to see more of this in games, where the player can move objects which dynamically detect hotspots on other objects and they can combine or interact. Weapon accessories will be present in an early stage in the next version as attached flashlights, which you can use as a starting point for other kinds of attachments.


    The hands and weapons in the Realistic FPS Prefab are animated in Maya. We can send you the source .mb files if you need them. Some tutorials on Maya, or another 3D app which can import/read .fbx files might be a good start.


    Thanks Takahama, yes weapons can fire projectile objects in the new version, most of the arrow functionality is achieved by a script attached to the arrow itself, which could be customized for bullet projectiles.


    Hi Defcon44, the errors indicate there is something going on with the AI navmesh agents not finding the navmesh. Does your pause menu work by setting Time.timescale to 0.0, or is the pause menu deactivating certain objects in the scene when paused? It looks like the AI is trying to find a destination on the navmesh, but either the navmesh or their navmesh agent has been deactivated. Some more information about your pause script would be useful in determining where the issue is. Hope that helps.


    Hi TryHarder, your first issue sounds like the screen touch is registering as a button press which constantly moves the screen up, instead of registering as a position on a virtual touch pad. Maybe the Easy Touch docs mention something about a button/dpad or virtual joystick mode for the track pad? The touch pad might also be trying to move the camera directly, when the scripts are expecting view movement values from InputControl.cs by default.

    All of the input calls for the Realistic FPS Prefab are located in the InputControl.cs script, which sets output vars that the rest of the scripts read. InputControl.cs is a good place to start when integrating another mobile control asset. Unfortunately I don't have a more in-depth tutorial on this at the moment, but in a future version, we're planning on integrating our own mobile controls. In the meantime, please feel free to send us an email or PM if you have any more questions.



    As for the next update, we missed the release estimate for March, really sorry about that. It's been difficult to pinpoint an exact release date because the next version is huge, and there's a lot of testing that has been going on in the past two or three weeks. All the features are done, but testing has revealed a few small fixes that were needed:
    • Underwater detection was still linked to first person mode, and needed to be separated from the player, so the camera can go underwater, regardless of if the player is holding their breath or not.
    • Third person movement direction change is smoothed (no more instant angle change).
    • Weapon models now snap to the correct angles upon switching camera modes (previously they held their old angles for one frame on transition).
    • NPCs now can play sounds when chasing a target and when alerted to player (user requested, didn't take long).
    • Main menu added to toggle features and access all game modes (better presentation, press Tab or Esc).
    • Improved player rigidbody interaction with complex, concave mesh colliders.
    • Realigned third person crouching animation.
    • Many other small fixes.
    Here is the preview webplayer demo. At this stage, it's just about improving quality and making sure that features work as intended. Continued testing may reveal some more minor bugs, but everything is done at this point. I would like to say that a release will happen this week, but it all depends on how the remaining tests go. Thanks once again for your patience as we finalize the next version.
     
  41. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Good news :D but take you'r time to make us an perfect release ;)

    For my problem, yes my pause menu "deactivate" the navmesh component, i go check how i can use somthing else :)
     
  42. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Great News, thank you.
     
    Deleted User likes this.
  43. Takahama

    Takahama

    Joined:
    Feb 18, 2014
    Posts:
    169
    @Azuline Studios i hope you make a tutorial for bullet stuff :D
    EDIT: Glitch detected! i just run to a rock near house(any other rocks do same thing) and it launch me in air like it was a ramp and i was a car
     
    Last edited: Apr 3, 2016
    Defcon44 likes this.
  44. Deleted User

    Deleted User

    Guest

    Deactivating the navmesh and navmesh agent should work, you just have to deactivate them both, along with the AI.cs script, so it's not trying to find a path on the deactivated navmesh or with a deactivated navmesh agent. It's usually easier to set Time.timescale to 0.0 for pausing, unless you need Time.time to continue at a normal rate for GUI effects or something else.


    Sure, the scripts will also be getting more tool tips, so you can hover your mouse over a variable in the inspector and see what it does without having to read the docs. Bullet projectiles will be similar to arrows, except that they won't stay in the scene after hitting a target and applying damage.

    The player launching over rocks when running was due to some testing of rigidbody and physics material settings. It should be back to normal now, though the player will still be launched slightly off inclined surfaces because the player controller is rigidbody based. These settings can all be customized as needed, though. Thanks for your feedback!
     
    llJIMBOBll, Defcon44 and QuadMan like this.
  45. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Hello , how to integrate the Easy Save backup system on RFPS ? thank you
     
  46. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Thanks Azu :)
    I go test it ^^

    EDIT:

    I have test something (navmeshagent stop) but that doesn't work :/

    I past you my pause script if somebody can help me with that :

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class NavMesh : MonoBehaviour {
    5.  
    6.     private NavMeshAgent Nav;
    7.     private Animator Anim;
    8.  
    9.  
    10.     // Use this for initialization
    11.     void Start ()
    12.     {
    13.  
    14.         Nav = GetComponent<NavMeshAgent>();
    15.         Anim = GetComponent<Animator>();
    16.  
    17.  
    18. Thank you
    19.  
    20.     }
    21.  
    22.  
    23.     // Update is called once per frame
    24.     void Update () {
    25.  
    26.         if(Input.GetKeyUp(KeyCode.Escape))
    27.         {
    28.             Nav.enabled = !Nav.enabled;
    29.             Anim.enabled = !Anim.enabled;
    30.         }
    31.     }
    32.  
    33. }
    34.  
     
    Last edited: Apr 4, 2016
  47. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    please also add one more feature in future update.
    open door with hand,hand pull and kick.
    please also include hand ,guns and animation maya files in package
     
    Last edited: Apr 4, 2016
  48. Dawar

    Dawar

    Joined:
    Dec 7, 2014
    Posts:
    123
    what
    do you really want? not understand your question well. please explain it in more detail
     
  49. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    For my pause menu when I press it turns time to 0 and this stops ai from moving, this is a way I done it

    Code (CSharp):
    1. private bool isMenuOpen = false;
    2. public GameObject PauseMenuPanel;
    3. public DepthOfFieldDeprecated dof;
    4.  
    5. void Update ()
    6.     {
    7.         if (Input.GetButtonDown ("Pause")) {
    8.             SetMenuStatus (!isMenuOpen);
    9.         }
    10.     }
    11.  
    12. private void SetMenuStatus (bool open)
    13.     {
    14.         isMenuOpen = open;
    15.         if (open) {
    16.             PauseMenuPanel.SetActive (true);          
    17.             dof.enabled = true;
    18.         } else {      
    19.             PauseMenuPanel.SetActive (false);          
    20.             dof.enabled = false;
    21.             Cursor.lockState = CursorLockMode.Locked;
    22.             Cursor.visible = false;          
    23.         }
    24.         Time.timeScale = open ? 0 : 1;
    25.     }
    26.  
     
  50. Defcon44

    Defcon44

    Joined:
    Aug 19, 2013
    Posts:
    400
    Thanks Jimbo, i have tried you'r script and he works good but this is not what i need.

    Because, i have my pause menu and in this pause menu (Upause Menu) i have already " if(Input.GetKeyUp(KeyCode.Escape))" so, with you'r script the time stop thats good but my menu can't opening :s

    So, i just need to update my little past script, i have search and i can use the NavMeshAgent.Stop but i get some error with it :/

    Any idea ? :s