Search Unity

Time Control and Pause Kit (inc. Bullet Time, Freeze, Fast Motion, etc) [RELEASED]

Discussion in 'Assets and Asset Store' started by SketchWork, Jun 28, 2013.

  1. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Hi fmarkus,

    You just need to add the group object to the objects you want paused and the time controller should pause these objects and leave any other objects un paused.

    Justin
     
  2. fmarkus

    fmarkus

    Joined:
    May 22, 2010
    Posts:
    181
    All of them? And also to all the prefabs that should be paused? mmmmm. Could be great to have the opposite script. Pause all but the one it's on with its hierarchy. Do you have anything like that?
     
  3. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Never really thought of a reverse component. I'll add it to my todo list.

    How many objects do you have in your scene?

    If they are instantiated why not include the time component in your prefab so it gets created with your objects?

    Justin
     
  4. kebabskal

    kebabskal

    Joined:
    Jul 26, 2013
    Posts:
    1
    I can't get TimeGroupController to work with mecanim. Unity 4.6.0b17 using 2D objects.
    What can I do to make it work?
    TimeGlobalController seems to work.
    Thanks!
     
  5. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Does this asset also give possibility to increase movement and animation speed of objects (eg 200%)?
     
  6. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    @kebabskal : I'll have to take a look as I am yet to do any testing on Unity beta 4.6. I can't see why it wouldn't work. Did you select Use Mechanim Events? If so try with that option off.

    @janpec : Yes, you have the option of increasing the percentage to make things go quicker.
     
  7. awardell

    awardell

    Joined:
    Feb 5, 2014
    Posts:
    71
    Hey I wanna point out two pretty big related bugs I found in SWP_TimedGameObject. First, I noticed that any rigidbodies being controlled would automatically be set to dynamic when I unpaused. "Why would you time-control a kinematic rigidbody?", you might ask. It happens that I have physics objects which I need to switch between dynamic and kinematic under certain conditions. My solution was to cache a bool saving the state of the rigidbody before the pause:

    Code (CSharp):
    1. if (rbRigidbody != null)
    2.         {
    3.             if (_fNewSpeed == 0f)
    4.             {
    5.                 vecSavedSpeed = rbRigidbody.velocity;
    6.                 vecSavedSpin = rbRigidbody.angularVelocity;
    7.                 boolSavedIsKinematic = rbRigidbody.isKinematic;
    8.                 rbRigidbody.isKinematic = true;
    9.             }
    10.             else if (_fNewSpeed != 100f)
    11.             {
    12.                 rbRigidbody.isKinematic = boolSavedIsKinematic;
    13.                 if (!rbRigidbody.isKinematic)
    14.                 {
    15.                     rbRigidbody.velocity = vecSavedSpeed;
    16.                     rbRigidbody.angularVelocity = vecSavedSpin;
    17.                 }
    18.             }
    etc.

    This led me to discover the second bug, because this code wasn't working when it should be. The bool would be cached, but when I went to assign it to rbRigidbody.isKinematic, boolSavedIsKinematic would always be true. I found that the function SetSpeedLooping actually calls SetSpeedAssigned EACH iteration, meaning that in one time-change SetSpeedAssigned will be called an additional time for every component being controlled. So with two components being controlled, boolSavedIsKinematic would be set to false and then immediately set to true on the next iteration. I moved the function call to SetSpeedAssigned outside of the for-loop and that solved all of the issues.
     
  8. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    @awardell, thanks very much for the report. I'll look into this for the next release.

    All the best,

    Justin
     
  9. PaulStuffs

    PaulStuffs

    Joined:
    Jan 10, 2013
    Posts:
    15
    Hi Justin,
    I just bought this off the assets store. I really like what you did with this plugin, however it is missing a few (very simple to implement) features:
    - SWP_TimedGameObject should have a boolean [V] to enable pausing for the object + all children. It's just too tedious to add it to all my objects and the children. My scene would be so much simpler if was an option.
    - Also I wish there was a way to disable all components (like the guys in PauseContoller plugin did). Because right now my objects don't really get paused, just their physics.
    - Looks like timescale doesn't really work for me and has weird behaviour. Like when I clicked the %25 a lot my rigidbodies seem to bounce around themselves.
    - Like previously mentioned, a "do not pause this" solution would work great for the global pause controller, since stuff like menus should never be paused (makes no sense to pause the pause menu :) )
     
  10. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    @DarkPlan Thanks for the feedback. I'll definitely look into your points. I have already started the "Pause all but this" function. Thanks again, Justin
     
  11. createasaurus

    createasaurus

    Joined:
    Sep 20, 2013
    Posts:
    9
    Hi Justin,
    I'm using 2 main 3rd party assets in my project, PlayMaker and UFPS. I haven't seen UPFS mentioned here. I'd like to Freeze the Player, even in mid air, when I start a dialogue sequence. The Player is a UFPS cam. Would your asset work in this scenario? Also, Imy project will be in Unity 4.3.
    With interest,
    createasaurus
     
  12. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Will really need this, watching.
     
  13. daudau505

    daudau505

    Joined:
    Jul 19, 2014
    Posts:
    27
    I just purchase this asset, and it works great for global pause but I can't seem to group pause anything that uses Playmaker FSM animating actions?
    I could be missing something here. Any tip would be greatly appreciated. Thanks
     
  14. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    @createasaurus: I have UFTP so I'll take a look and let you know how to get it working.

    @daudau505: Just sent you an email.

    @Everyone Else: I'm away on vacation till the 28th, so any questions please post them here and I'll reply upon my return.

    Have a great Christmas.

    Justin
     
  15. TarlSS

    TarlSS

    Joined:
    Apr 26, 2014
    Posts:
    21
    Trying to get this to work with my 2d Project. The Global controller seems to work, but not the group controller. What gives?

    When I add the TimedGameObject script to anything with a rigidbody2d component, it doesn't seem to be effected by the group controller. It might as well not even be there.
     
  16. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    @TarlSS: Does this do the same with the latest version I released the other day?
     
  17. tuliotus

    tuliotus

    Joined:
    Jan 24, 2015
    Posts:
    1
    I had the same question as Daudau505, so currently, I am just not using your plugin, just enabling/disabling the FSM, but I'd like to use your plugin with the playmaker events.
     
  18. Berryblue031

    Berryblue031

    Joined:
    Feb 29, 2012
    Posts:
    3
    I recently found a bug in how RigidBodies are paused/unpaused when pausing in swp_timedgameobject rigidbody.isKinematic is set to true and when unpausing rigidbody.isKinematic is set to false. It shouldn't force set this to false it should restore it to the original value.

    Also you may want to support NavMeshAgents you can do this by adding the below chunk to swp_timedgameobject.SetSpeedAssigned
    Code (csharp):
    1.  
    2. if (navAgent)
    3.         {
    4.             if (_fNewSpeed == 0f)
    5.             {
    6.                 if (navAgent.hasPath && !navAgent.isOnOffMeshLink)
    7.                 {
    8.                     navAgent.Stop();
    9.                 }
    10.             }
    11.             else
    12.             {
    13.                 if (navAgent.hasPath && !navAgent.isOnOffMeshLink)
    14.                 {
    15.                     navAgent.Resume();
    16.                 }
    17.             }
    18.         }
    19.  
     
  19. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    @Berryblue031 thanks for the code snippet. I'll add this and the isKinematic fix to the next release.
     
  20. Zumx

    Zumx

    Joined:
    May 12, 2014
    Posts:
    5
    Hi, this works well on mobile?
     
  21. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Hi there,

    Yes it works fine on mobile. We used it on a few previous military mobile projects. I'm also actually using it in our upcoming mobile game at the moment.
     
  22. arcdragon1

    arcdragon1

    Joined:
    Oct 15, 2012
    Posts:
    116
    hi team.
    i have trouble a little.
    i attach playmaker component(action is Rotate y=10 everytime) and SWP_Timed Game Object to target gameobject.
    but its object doesn't pause when called TimeGroupController.PauseGroupTime().
    ofcourse, SWP_Timed Game Object component property "Time Group Controller" is TimeGroupController script.
    Group id is default 1.
     
  23. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Hi arcmohudragon,

    This should work fine. I'm not in the office at the moment. I'll check when I am back in the morning.

    All the best,

    Justin
     
  24. ZacCom-Corp

    ZacCom-Corp

    Joined:
    Apr 5, 2013
    Posts:
    10
    I have a issue just pick this up for my project and got it working well in playmaker. However, now all the scenes are paused infinitily without pause turned on. I deleted and reloaded it and still have same global pause on with no scripts or pause prefabs attach. I even took everything out of my project that said pause and every scene is still paused. This is a problem I might have to recreate my project now with 100s of hours of work because it never getting out of pause state. Also, if i click unpause it is still paused. What to do?
     
  25. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Hi @ZacCom Corp,

    Might just be worth checking that the timestep hasn't changed for your project for some reason.

    Edit - Project Settings - Time

    make sure Time Scale is set to 1.

    Justin
     
  26. ZacCom-Corp

    ZacCom-Corp

    Joined:
    Apr 5, 2013
    Posts:
    10
    I never knew that was there. I check that out thanks.
     
  27. ZacCom-Corp

    ZacCom-Corp

    Joined:
    Apr 5, 2013
    Posts:
    10
    Thanks that fixed it.
     
  28. pampapic

    pampapic

    Joined:
    Sep 14, 2013
    Posts:
    11
    Hi,

    I bought the Time Control and Pause Kit few time ago and I wanted to know if there is a way to pause a parent gameobject AND all its children gameobject with the time group controller ? For now I can't find how to do it.

    I really don't want to add the timed gameobject script to hundreds of children gameobjects. It is very annoying because out of it everything just works fine, this feature can be really useful in many situations.


    Thank you for your answer.
     
  29. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    @pampapic I was just replying to your email :) At the moment it will effect the game object it is on. What are the 100's of child objects that are under the parent object? If you let me know I could take a look.

    All the best, Justin
     
  30. pampapic

    pampapic

    Joined:
    Sep 14, 2013
    Posts:
    11
    Thanks for the reply Justin :) sorry i'm not really patient ^^

    Basically i have a main gameobject named "Game" which contains many different stuffs such as player and enemies, animated ui (kind of a hud done with unity gui) and tons of bullets that are spawned with poolmanager 5 within this gameobject. It's a kind of a 2D bullet hell shooter and i'm working with many 2D rigid bodies (the bullets).

    So I wanted to "freeze" that "Game" gameobject (and all its child objects as well) when the user touch the pause button i've made... It's working well with the time global controller but I need to display a pause menu, wich I don't want to pause of course because the user need to interact with, it will contains a "resume" button, an "options" button... etc.

    If I can pause all but not the pause menu it's even better, i will no longer need to keep that huge "game" gameobject that contains everything.

    Hope that it makes sense, I tried to be as clear as I can with my approximate English, and as you can see i'm really lost :-D
     
  31. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    @pampapic I see what you are after now. leave it with me and I'll see what I can do :)

    Justin
     
  32. pampapic

    pampapic

    Joined:
    Sep 14, 2013
    Posts:
    11
  33. daville

    daville

    Joined:
    Aug 5, 2012
    Posts:
    303
    @SketchWork this might be obvious but... before purchasing... will this allow to make an Animated Pause Menu using unity's UI?
     
  34. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hello,

    I want exactly the same feature, and I guess this is not possible without touching your update, fixedUpdate and lateUpdate methods. This is a comon problem, I don't know why Unity doesn't have any solution for that. In my case I need a bit more, running a minigame until the main game is in pause mode.

    void update() {
    if (Paused)
    return;
    ....
    }
     
  35. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Hi there,

    Sorry for not answering sooner, I'm been away with the family :)

    There are a few ways to accomplish this. Try adding the timed script to your bullet prefab all with the same group id so when the timed group controller pauses they already have the group id assigned and are already associated with the bullets and should all pause correctly leaving your menu to carry on at the normal speed.

    Let me know how you get on.

    take care,

    Justin
     
  36. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    393
    Should this work with Unity 5? Doesn't seem to be working on my end.
     
  37. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Hi,

    Yes, everything should work fine in Unity 5. We are using it in our current Unity 5 project. What problems are you experiencing? Also, can you run the example scenes and see if everything is working in them.

    Many thanks,

    Justin
     
  38. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    393
    Ok, the example scene works. The only difference I see is my project uses a mecanim animation. I will dig around. Are there plans to support the Cinema Director plugin? Thanks!
     
  39. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    393
    Any reason why my mecanim animation doesn't stop?

    Adding a TimedGameObject changes the starting value of my RigidBody's isKinematic value? That's quite strange behaviour? Why?
     
  40. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    I'll take a look at how Mecanim is working and get back to you.

    Justin
     
  41. Lightrail

    Lightrail

    Joined:
    Apr 12, 2013
    Posts:
    37
    Hello,

    I recently purchased the asset and I've been trying to get the group time controls to work. The global ones work no problem. They're linked up the prefab, the IDs match, my time scale is 1 but they don't want to pause. The debug controls on the prefab don't seem to work either. I'm using Playmaker to control them but I've also tried scripting but no dice (activating the global controller works using Playmaker as well). Any ideas?
     
  42. Lightrail

    Lightrail

    Joined:
    Apr 12, 2013
    Posts:
    37
    So I got the debug controls to respond normally. I have it so that when I press enter, the game should pause. Now, when I press enter, the group controller prefab in the scene shows what the correct speed ought to be, but the objects still do not respond accordingly. I've checked with the demo scene again, and it looks like I'm attaching the proper components but for for the life of me I can't tell what I'm doing wrong.
     
  43. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    @Lightrail Hi Ron, just sent you an email. We'll get you up and running.
     
  44. The_Domaginarium

    The_Domaginarium

    Joined:
    Dec 11, 2012
    Posts:
    20
    Hi there,

    I've been using this asset for a little while, but I was wondering if it is possible to pause audio. I see it "mutes" audio by default, but I need it to pause for instances where, for example, you pause the game when an NPC is talking.

    Thanks
     
  45. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    That should be easy enough to accomplish. You'll just have to change the mute code to pause instead. I'll add a switch for this in the next version :)

    Justin
     
  46. jonijoba

    jonijoba

    Joined:
    Jul 17, 2013
    Posts:
    7
    Hi Justin,
    Would you have a 3rd-party code fordotween?
    Thanks by advance
     
  47. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Hi jonijoba,

    What exacty are you after for integration with DoTween?
     
  48. jonijoba

    jonijoba

    Joined:
    Jul 17, 2013
    Posts:
    7
    Hi Justin,
    I just would like to slowdown cubes in translation/rotation using your asset. My aim is to manage the speed of groups of objects while being able to keep the camera orbiting around them with no impact on camera speed (I bought your asset because I didn't manage to separate speeds with unity timescale) .
    My current project is on unity4 with playmaker & dotween/

    Thank you for your help
     
    Last edited: Aug 20, 2016
  49. gekidoslair

    gekidoslair

    Joined:
    Sep 7, 2012
    Posts:
    128
    yeah same issue here - using mecanim and also a navmeshagent, but neither are being affected by the group controller pause events.

    Looking in the code it seems like the mecanim stuff is wrapped in a huge #if preprocessor chunk, ie:

    #if UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0
    [do mecanim stuff]
    #endif

    but since i'm in Unity 5.4.x all of this code isn't active.

    Should update the Unity 5 defines to be UNITY_5 instead of UNITY_5_0 because this is a specific 'unity 5.0.x' define. Just using 'UNITY_5' will mean that code works for 'any' Unity 5 version.

    What I did to fix this is just replace all of those long compiler directives with this:

    #if UNITY_5_3_OR_NEWER

    because I'm not bothered with old Unity versions personally. By changing all of the #if entries in SWP_TimedGameObject.cs I can confirm mecanim pausing now works.

    Seems like I'll have to do some custom magic for the NavMeshAgent pausing, which is unfortunate, but relatively minor.
     
  50. gekidoslair

    gekidoslair

    Joined:
    Sep 7, 2012
    Posts:
    128
    have a basic version of the timing working with NavMeshAgents using Stop() and Resume(), but there seems to be a half-second lag before the navmeshagent stops moving unfortunately. Makes syncing with the animations look a little weird...hmm...will keep investigating.