Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Chronos – Time Control – Unity Awards Winner

Discussion in 'Assets and Asset Store' started by LazloBonin, Apr 9, 2015.

  1. rerwandi

    rerwandi

    Joined:
    Dec 8, 2014
    Posts:
    544
    im moving into LeanTween now.
    im trying to do the same thing is iTween (replacing code in your migration page)
    but i cant using Chronos; in LeanTween file as its in 'Plugins' Folder.
    what did you do to make it works ?
     
  2. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    Another user told me he got it working using this code:

    Code (CSharp):
    1.     void Update ()
    2.         {    
    3.             LeanTween.dtManual = GetComponent<Timeline>().deltaTime;
    4.             LeanTween.scale(this.gameObject, Vector3.one*3f, 1.0f).setUseManualTime(true);    
    5.     }
    If you put Chronos in a Plugins folder, put LeanTween in a Plugins folder too, otherwise they will try to compile separately and it might not work.
     
  3. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
  4. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    I will test the new update 2.0.1 and see what I can do

    I think that this is really a game changer and love the idea, and is great to be able to control the time in this way that you have done and be able to show the real and amazing beauty of slow motion things that let you show things that you would not be able to see in real time

    For example see this short trailer

    Insurgent | Exclusive Super Bowl Pregame Trailer | MTV



    Sorry, reading your answer I think I have explained it badly and wrongly what I suggested, because what I wanted to tell is to have a much more simple basic and essential step by step of what is needed to add to our own scene to be able to control the time in the most basic way, just slow down everything in the scene, without any special or custom thing, no individual items or groups or anything else, just only slow down the time.

    And I only suggested IF WANTED to make additional and extended tutorials for other possible combinations but not required to do a tutorial for these

    What I was thinking is a very simple and short list as told above

    Do I need to add additional custom scripting that I should do?

    You answered to me the following

    So this is why I asked what are the real and essential things to be done to use Chronos in a simple way that are not directly related to the 2D demo scene in the tutorial

    Thanks for your help and sorry if I did not explain it correctly
     
  5. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
  6. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    If you follow his Tutorial exactly at http://ludiq.io/chronos/tutorial , it explains step-by-step exactly what's needed to get the most basic time slow. Just ignore all the pictures of the 2D tutorial and read what he wrote.

    I.e. "MODIFYING THE ENEMY SCRIPT" is where you'll use that code in your own mobiles to control their movement, "SETTING THE TIME SCALE VIA INPUT" is where you can reference the code to write your own for the slider you want, which would set the Root clock scale to whatever, slowing down or pausing time.

    His tutorial and documentation are amazingly well written and step-by-step to follow, probably the best documentation I've seen for an asset (main influence on me purchasing it!), so try reading it over a few times and post specific things that you're having trouble following.

    (Really, just ignore the 2D Demo and apply the code to your own project, it's what I did and was able to have something basic really quickly)
     
  7. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    Hotfix for some Playmaker Physics Actions
    A user reported a bug with some PlayMaker physics actions.

    Symptom: ArgumentException: GetComponent requires that the requested component 'RigidbodyTimeline2D' derives from MonoBehaviour or Component or is an interface.

    The fix will be included in v.2.0.3. Meanwhile, you can fix it manually with the following Search & Replace in the whole solution:

    Search: CheckForComponent(typeof(RigidbodyTimeline2D))
    Replace: CheckForComponent(typeof(Timeline))

    Search:
    CheckForComponent(typeof(RigidbodyTimeline3D))
    Replace: CheckForComponent(typeof(Timeline))
     
  8. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    Thanks very much for your answer and your help, specially when you are not the author, so is kind and helpful from you

    I agree that the tutorial is very well written and easy to follow and explain it very well step by step how to do it ( at least until you reach nearly the end where is more mixed and I get a lost a bit) BUT is always in reference to the 2D Unity scene tutorial and what is inside that specific demo scene.

    So this tutorial is very specific to this 2D scene, but maybe, as you say well, I should ignore the references to it and take only what may be general and for any project, and modify and make the migration of the enemy scripts

    PHYSICS EXPLOSIONS?

    In the 2D demo scene there is no physics explosions, so they are not included in the tutorial

    It has been told that to be able to make similar amazing physics explosions using the Fracture & Destruction asset as shown beautifully in the demo video, I should attach clocks to each one of the chunks or pieces of the fractured 3D object?

    Also I have enemies that explode into tiny bits, so I should attach clock to each of the bits of the exploding effect?

    Thanks for any help and sorry very much for being a beginner without the enough knowledge and skills about Unity to be able to use this and understand it in a better easier way.

    Best wishes
     
  9. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    Just imported the new v2.0.2 this error upon import: using unity 5.0.1 f1 and new project

    Assets/Chronos/Source/Timekeeper.cs(11,10): error CS0246: The type or namespace name `HelpURLAttribute' could not be found. Are you missing a using directive or an assembly reference?

    if remove this line then get tons of errors, did you test this before uploading it to the asset store?

    please fix as is unusable in present state, why is there a web address in the script to start with?

    so i am still using the older v1.02

    there seems to be a problem with chronos and addforce, when in slow mode the force added to objects is mkes them faster than when in normal mode and when in accelerate mode there is hardly any force applied, say i have a cube with verticle force of 50, in slow mode the force seems to be much more as the cube will rise faster than in normal mode, when in accelerate the cube cant even lift off the ground so something is not right, please can you fix it, thanks
     
    Last edited: Jul 20, 2015
  10. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    Hi Melonhead,

    As stated on the asset store page, Chronos v2+ requires Unity 5.1 (which includes the HelpURL attribute). HelpURL is used to link the inspector's little help button (a book icon in the top right corner) to the online documentation -- there is no download going on behind the scenes, don't worry.

    Can you post the code you are using for AddForce? I did rigorous testing that Rigidbodies behaved exactly the same (at different speeds of course) before releasing v1, and I haven't touched the physics code since then, so there shouldn't be a problem.

    Are you using GetComponent<Timeline>().rigidbody.AddForce instead of GetComponent<Rigidbody>().AddForce?
     
  11. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    I answered this question earlier in the thread, but yes, basically: attach a Timeline (with Record Transform enabled) to every piece, and call the plugin's Explode method with the force multiplied by the time scale.

    Here is, my whole Missile class with full comments (used for the demo):
    http://pastie.org/10302573
     
  12. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    Best asset youtube video ever.created.ever.
     
    LazloBonin likes this.
  13. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    ok i changed my code to "GetComponent<Timeline>().rigidbody.AddForce" then i get this error:

    Assets/TORQUE7.cs(18,30): error CS0246: The type or namespace name `Timeline' could not be found. Are you missing a using directive or an assembly reference?

    so i dont know what is happening as i have the timeline script on my object?

    this part <Timeline>().rigidbody.AddForce is now in red whereas before <Rigidbody> was in blue, not sure if this gives a clue as to what is wrong here
     
    Last edited: Jul 20, 2015
  14. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    Add using Chronos; to your namespaces.

    I suggest you have a look at the tutorial, where all of this is covered: http://ludiq.io/chronos/tutorial
     
  15. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    More specifically, have a look at the "Modifying the enemy script" part.
     
  16. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    I will take a read, i purposly only looked through the documentation and not the tutorial as it seemed to be only modifying the 2d game, the 3d demo that comes with the package is very complex , maybe include a very simple basic 3d demo with one object so people can see it work easier. thanks
     
  17. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    217
    The asset is neat, I picked it up a while ago. But there's one functionality that is missing that I'd absolutely love. I know you said it isn't designed for replaying or saving keyframes, but that would be amazing.

    Our game is highly physics based and our tutorial changes based on device FPS due to FixedUpdate / FixedDeltaTime not being perfect. Using keyframes to monitor and record all the physics interactions and then play them back is really what I'd love the asset to do.

    Then you'd have full time control with both rewinding and "fast forwarding" (up to the point you started recording / rewinding).

    Or are you making it but having it be a separate asset? I bought Chronos specifically thinking it could do something like that... =/
     
  18. Darksunrise957

    Darksunrise957

    Joined:
    Jul 1, 2015
    Posts:
    15
    Hi, ever since I saw this asset, I had planned on buying it. Unfortunately, though, I noticed a very distinct lack of any ability to save timelines, so I looked through all of the documentation, then all of this thread, hoping to find a way to save them. If your upcoming "replay" asset does this, I would be very glad, but I'm somewhat worried about compatibility; hopefully they both work together seamlessly.

    The Player would need to be able to play through normally, then at death they could rewind time, from which they could continue on a different path. That's all possible with your current script, but that's not all that needs to be done. The Player would have to be able to jump between different saved Timelines, forward or backward, they would be able to project one Timeline onto another, and most importantly, save and load games that have a number of these different Timelines, from where you could continue playing. The main problem, it seems, is that this excellent asset cannot be used for anything other than individual, disconnected levels at a time, which is regretful.

    Any updates on that replay project, BTW? Any information would be greatly appreciated...

    Thanks.
     
  19. Zorranco

    Zorranco

    Joined:
    Jul 15, 2014
    Posts:
    23
    Sorry if it's a noob question, but I have no much coding experience...

    I see the system relies on rigidbodies, but I read here before that virtually anything can be time controlled. Is there any easy way (with playmaker, if possible) to do what you see on example scene but only with character controllers?

    Thanks.
     
  20. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630

    HAVE TRIED USING THIS BUT UNITY SAYS THE SCRIPT NEEDS AN API UPDATE AND CHANGES THE LINE TO:

    GetComponent<Timeline>().GetComponent<Rigidbody>().AddForce(0,speed,0); you can see it adds GetComponent back in before <Rigidbody>

    WHEN RUN THE FORCE AND GRAVITY ARE STILL THE SAME I HAVE ADDED THE USING CHRONOS AND BASEBEHAVIOUR AND STILL NOT FUNCTIONING CORRECTLY ON SLOW THE FORCE IS FASTER THAN NORMAL AND ON ACCELERATE THERE IS NO FORCE APPLIED
     
  21. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    Hi Stexe,

    Yes, I'm working on a replay plugin as a separate assets. A lot of things are extremely different when dealing with replay (namely, serialization), and it's likely not to ever be included in Chronos. However, I believe my Replay and Chronos plugins will be compatible (e.g. you can record Chronos-affected games).

    Indeed, these are Chronos limitations. I'm sorry it can't fit the purposes of your game. I was working on Replay intensely for the last weeks, but I've now hit a roadblock I'm not sure how to circumvent. There might be some serious delays; I'm considering putting the project on hold and taking some vacations (I'm just one guy! ;) ) to come back to it fresh later.

    Chronos doesn't *rely* on Rigidbodies; it *can* affect them, but it's not necessary to use them. There is an example PlayMaker scene included in the package (Chronos/PlayMaker/Example.unity) which shows various objects (simple scripts, rigidbodies, nav mesh agents, particles, music, animators, etc) being affected by time control groups.

    There's no need to be agressive, please. I see the script updater is trying to change it when it shouldn't, I'll look at what I can do. In the mean time, can you say "No" when it prompts you to update your scripts? It isn't ideal, but at least it should allow you to continue working. As you noticed, with GetComponent, it won't work -- it needs to be just "rigidbody".
     
  22. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    Hi Melonhead,

    I've just tried the following line on my machine and I don't get a Unity API Update prompt:

    Code (CSharp):
    1. GetComponent<Timeline>().rigidbody.AddForce(new Vector3(10, 20, 30));
    Could you tell me exactly which line of code you are using? And which Unity version?
    If all else fails, try creating a blank project, importing Chronos, then using this line; does the update prompt still show up then?
     
  23. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    can you please give us a a demo of a simple cube on a plane using addforce to raise the cube and using timecontrol script cause i have followed everything and for starters when changing time with the keys it also changes the angular drag of the rigidbody, the cube rises quicker on slow than it does on normal or accelerate so i dont think it is possible for you to show this working as it seems impossible to use addforce with chronos, if you say it does work then please let us download an example so i can see where i went wrong, i am only asking for a simple demo so it should not take you long to do cause i am really stuck, i really dont know why you made the tutorial using a 2d game seeing as most people using unity would be making a 3d game.
     
  24. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    217
    Ah, thanks for the reply. Shame to hear that since it is really the primary reason I got Chronos. Was hoping I could do "timeline scrubbing" with physics. You might want to put a note on the asset store that it isn't designed for that. From the way it reads currently it seems like you can get access to the timeline itself on an object instead of just using it once.
     
  25. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    Hi melonhead,

    I'll tell you how to set up that scene step by step.
    1. Create a new project, import Chronos
    2. Create a new scene
    3. Create a Timekeeper from the GameObject menu
    4. Add a plane as the ground and your cube above
    5. Add a Rigidbody and BoxCollider to your cube if it doesn't already have one
    6. Add a Timeline to the cube via Add Component > Time > Timeline
    7. Set its mode to Global and its parent to Root
    8. Make sure "Record Transform" is checked on the Timeline
    9. Add the following script to the cube:
    Code (CSharp):
    1. using UnityEngine;
    2. using Chronos;
    3. using System.Collections;
    4.  
    5. class ChronosTest : MonoBehaviour
    6. {
    7.     Timeline timeline;
    8.  
    9.     void Awake()
    10.     {
    11.         timeline = GetComponent<Timeline>();
    12.     }
    13.  
    14.     void Start()
    15.     {
    16.          StartCoroutine(Jump());
    17.     }
    18.  
    19.     IEnumerator Jump() // Jump every 3 seconds
    20.     {
    21.         while (true)
    22.         {
    23.             timeline.rigidbody.AddForce(new Vector3(0, 10, 0));
    24.             yield return timeline.WaitForSeconds(3);
    25.         }
    26.     }
    27. }
    Press Play. Your cube should jump up every 3 seconds. From the Scene hierarchy panel, select the Timekeeper. In the inspector, you can click and hold on the "Time Scale" field of the "Root" global clock to control time. Tell me if the cube still doesn't behave like it should.
     
  26. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    thanks i will go try it now
     
  27. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    ok at step 7 i have set mode to global then there is no parent option the only other option that opens is called global clock which has a selector for either none or root and there is no tick box or mention of record transform, here is pic timeline box.JPG
     
  28. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    Oops, my bad, yes that's fine, I meant to set the "Global Clock" to "Root". This setup is ok.
     
  29. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    so after pasting the script unity says t needs an API UPDATE and then changes the script to the following:

    Code (CSharp):
    1. using UnityEngine;
    2. using Chronos;
    3. using System.Collections;
    4.  
    5. class ChronosTest : MonoBehaviour
    6. {
    7.     Timeline timeline;
    8.    
    9.     void Awake()
    10.     {
    11.         timeline = GetComponent<Timeline>();
    12.     }
    13.    
    14.     void Start()
    15.     {
    16.         StartCoroutine(Jump());
    17.     }
    18.    
    19.     IEnumerator Jump() // Jump every 3 seconds
    20.     {
    21.         while (true)
    22.         {
    23.             timeline.GetComponent<Rigidbody>().AddForce(new Vector3(0, 10, 0));
    24.             yield return timeline.WaitForSeconds(3);
    25.         }
    26.     }
    27. }
    as you can see it adds GetComponent after timeline.

    press play and nothing happens to the cube
     
  30. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    am i meant to add a physics timer 3d to the cube?
     
  31. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    Ahhh! You're still on version 1. That explains it. You have to update to version 2.

    (PhysicsTimer3D has been replaced by Timeline.rigidbody in V2).
     
  32. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    ok i see, i will do it later, so i will also need unity 5.1 aswell as i am currently on 5.0.1 f1,

    i will post back when i have checked i out again, thanks
     
  33. Darksunrise957

    Darksunrise957

    Joined:
    Jul 1, 2015
    Posts:
    15
    Aww, that's really unfortunate. :(
    I was hoping that it wasn't too far away, but I can understand there being roadblockss and limitations that pop up out of nowhere. Hopefully you'll find a way to get it working!
    So have a nice vacation, etc. And maybe you'll get an epiphany about it at some point... ;)
     
  34. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    ok i updated unity to the latest version and downloaded the latest chronos, still dont seem right, can you please try this:


    1 Create a new project, import Chronos
    2 Create a new scene
    3 Create a Timekeeper from the GameObject menu SET ITS KEY TO Cube PARENT TO None
    4 Add a plane as the ground and your cube above
    5 Add a Rigidbody and BoxCollider to your cube if it doesn't already have one
    6 Add a Timeline to the cube via Add Component > Time > Timeline
    7 Set its mode to Global and its parent to Cube
    8 Make sure "Record Transform" is checked on the Timeline
    9 Add the following script to the cube:

    Code (CSharp):
    1. using UnityEngine;
    2. using Chronos;
    3. using System.Collections;
    4.  
    5. class ChronosTest2 : MonoBehaviour
    6. {
    7.     Timeline timeline;
    8.  
    9.     void Awake()
    10.     {
    11.         timeline = GetComponent<Timeline>();
    12.     }
    13.  
    14.     void Start () {
    15.     }
    16.     void Update ()
    17.     {
    18.         if (Input.GetButton ("Jump"))
    19.      
    20.  
    21.         timeline.rigidbody.AddForce(new Vector3(0, 20, 0));
    22.     }
    23. }
    the cube still rises at the same rate in all 3 speed modes, it only falls at the speed it should in each mode, now is it to do with using void update as if i use fixedupdate the cube will not even lift off in accelerate so how can i change the script to use a key to lift the cube without using the void update if that is the problem

    if you change the slow mode from 0.5 to 0.1 you will see an even bigger difference in force applied, if chronos is only affecting time then in all speed modes the cube should still only rise to the same point in height but just slower in slow and quicker in accelerate but you can clearly see that a quick press of the space bar results in the cube reaching different heights in the 3 time modes which is not right if only speed is being affected, either mass or gravity is being affected or more force is applied at slower speed.

    better to place 3 cubes in a row with a seperate clock for each 1 set to 0.5 speed one set to 1.0 speed one set to 2.0 speed then press space you can see the slower the time the higher the cube so it looks like each time script is affecting how long the key is held down , so on slow you need to hold the key half the time of normal and a quarter the time of accelerate which makes it very hard for games where objects have to move a certain distance controllled by force as when you switch to slow the object will move further than it should and in accelerate would movw less tha it should so from what i see chronos is not compatible when using addforce, so it looks like force over time is being affected which is not what should happen, if i have a game where an object moves from 0 to 100 by force being applied for 1 second you would expect in slow that the object would still only go from 0 to 100 with 1 second of force but take twice the time and half the time in accelerate but the distances are being affected as it is multiplying the force over time so increasing the force in slow by 2 and half the force in accelerate which is not right.

    also i can see that this would probably be affecting torque and velocity but have not tested this yet.
     
    Last edited: Jul 22, 2015
  35. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    What you are reporting is very strange. I tested specifically these scenarios (multiple objects being lifted at different time scales) when developing the physics processor for Chronos, and they rose at exactly the right speed, to exactly the same height. Maybe I changed something inadvertently in the latest versions that caused it to bug. I'll do some extensive testing and try to get back to you ASAP. Unfortunately, the PSU on my development computer broke and I have to get it replaced, so it might take a week or two.

    In other news, v.2.0.3 is out with some bugfixes: http://ludiq.io/chronos/changelog
     
  36. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    @lazlo thank you , happy to help, hope it is a bug and can be fixed, also can chronos be used with hinges, say a hinge break and then rewind and have the hinge reconnect, is this possible using record?
     
  37. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    I'm having an issue with a 2D rain particle prefab from 'PixelWeatherFX', when I add Chronos components to it, everything works as it should (slowing down time, pausing, etc), without me needing to do anything manually, but the processing time increases and increases as time goes on.

    Is there something I need to do to improve particle performance, or would it be a setting in the rain particles that is causing the conflict?

    I saw
    in your documentation, but I'm not totally sure if that's related to this.

    Thanks for any help. I've attached a screenshot of what the Profiler shows after a few seconds, eventually it climbs to 90ms+.

    Example 1.png
     
  38. Arx

    Arx

    Joined:
    Jan 28, 2014
    Posts:
    22
    I have a problem with instantiation from prefab. I'm working on a 2D platformer where I want to instantiate a shot that should adjust its speed with respect to its timeline.

    The shot prefab looks like this:
    shot.png

    And the instantiation code is:
    Code (CSharp):
    1. Transform shotInstance = Instantiate(shotPrefab, transform.position, shotRotation) as Transform;
    2. shotInstance.GetComponent<ShotAmmo>().time.rigidbody2D.AddForce(shotInstance.right * shotForce);
    Of course, ShotAmmo script, which is attached to the shot object, has this member called "time" as per tutorial.

    I'm getting this error:
    Which is caused by the fact that
    Code (CSharp):
    1. shotInstance.GetComponent<ShotAmmo>().time.rigidbody2D.component
    is null.

    What am I doing wrong? Why does the Timeline component considers the Rigidbody2D component as null?

    Thank you very much!
     
  39. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    Another issue I'm wondering about, is I'm lerping a value as soon as the game starts, however the deltaTime the Root clock gives is different from Time.deltaTime, for the first couple seconds, before normalizing and matching it.

    Code example:
    Code (CSharp):
    1.  
    2.             float elapsed = 0f;
    3.            
    4.             while (elapsed < duration)
    5.             {
    6.                 Debug.Log("Normal Time: " + Time.deltaTime + ", AbstractTime: " + AbstractTime.Root.deltaTime);
    7.                 elapsed += AbstractTime.Root.deltaTime;
    8.                 agent.scale = Mathf.Lerp(endScale, startScale, elapsed / duration);
    9.                 yield return null;
    10.             }
    The log generated is:
    Code (CSharp):
    1. Normal Time: 0.02, AbstractTime: 3.84397
    2. Normal Time: 0.02, AbstractTime: 0.2058277
    3. Normal Time: 0.3333333, AbstractTime: 0.7625465
    4. Normal Time: 0.07693902, AbstractTime: 0.07693902
    5. Normal Time: 0.03684753, AbstractTime: 0.03684753
    6. <snip>
    AbstractTime.Root is just a cached reference to Timekeeper.instance.Clock("Root")

    Now I'm guessing the initial time difference is because of the startup lag time, elapsed time isn't getting reset after loading everything (I remember something about this from XNA I think), but as you can see the second time 'almost' matches Unity's deltaTime, the third one is totally off, and then after that it matches.

    This breaks what the lerping I had going when the game started, is this a bug or is there a workaround I can do? Thanks for the help!
     
  40. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    One thing I noticed, each time I play a scene while running Chronos, the time on the components is modified and 'taints' the scene, causing it to be marked as modified.

    Is it possible for you to change it in the future that it doesn't keep the local time/delta time/simulationStarted values after exiting play mode (assuming there's not a coding reason for it)

    It's not a huge issue, but it'd be nice to not have the scene modified for GIT purposes each time it's run.

    Example.png

    Thanks in advance, really liking Chronos!

    Edit: PS: At http://ludiq.io/chronos/documentation#Occurrence for your tutorial, the code incorrectly says "GetComponent<Timeline>().Plan(5, delegate { ChanceColor(Color.red); });", it should read ChangeColor
     
    Last edited: Jul 26, 2015
  41. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    Ah, that's because it gets set a in awake I believe. Try calling CacheComponents on time after instantiating it.

    That's odd, these shouldn't even be serialized. There is no coding reason for it. On which component is this serialization occurring? This doesn't seem like a Clock or Timeline, it seems like a built-in Unity component.

    Thanks for the typo, I'll get it fixed eventually.

    I think this is mostly related to startup lag; I'm not sure how I can change it to be reliable. After all, Chronos components are just Unity scripts -- I'm limited by normal loading delays and whatnot (I don't have a deeper access to Unity's timing code).
     
  42. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    Heads up: my development computer broke and I'm left without a PSU for the next week or two.
    I decided to take some time off in the mean time and come back fresh to Chronos afterwards.
    Support may be slow or largely delayed for the next week or two, but I think 2.0.3 is pretty stable!
     
  43. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    Thanks, actually you're right, I just changed to Text assets and noticed it the other day, so I was thinking it was Chronos at the time, but it's actually Particle Playground serializing those values. Fixed it on my end and contacted its author.

    Okay, that's too bad about the time, I guess I can delay it by a few frames so it becomes accurate. I'm new to Unity, but it's kind of weird that whatever they're doing is causing a script to report a different time than their own time for the first few frames.

    Good luck with fixing the computer!
     
  44. Ssiroo

    Ssiroo

    Joined:
    Jun 17, 2014
    Posts:
    10
    Hey,

    Im trying to create a 3D Area Clock which will slow down some transforms(AI) that are moving using unity's navmeshagent system. When I use the GetComponent<Timeline>().navMeshAgent.speed to change its speed it doesn't do it. BUT if the transform is INSIDE the collider(3D Area Clock collider) it does change it, and if the transform goes outside the collider and I try to change the speed it doesn't do it, the animations do slow down though. Here's the code(useless stuff aren't shown):

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Chronos;
    4.  
    5. public float walkSpeed;
    6. public float runSpeed;
    7.  
    8. NavMeshAgent navMeshAgentt;
    9. Timeline timeline;
    10.  
    11. void Start ()
    12.     {
    13.         navMeshAgentt = GetComponent<NavMeshAgent>();
    14.         timeline = GetComponent<Timeline>();
    15.         timeline.navMeshAgent.speed = walkSpeed;
    16.         timeline.navMeshAgent.angularSpeed = rotationSpeed * 100;
    17.     }
    18.  
    19. void Update ()
    20.     {
    21.         MoveAround();
    22.     }
    23.  
    24. void MoveAround()
    25.     {
    26.  
    27. if(Input.GetKey(KeyCode.Mouse1))
    28.         {
    29.             timeline.navMeshAgent.speed = runSpeed;
    30.             isRunning = true;
    31.         }
    32.  
    33. if(Input.GetKeyUp(KeyCode.Mouse1))
    34.         {
    35.             timeline.navMeshAgent.speed = walkSpeed;
    36.             isRunning = false;
    37.         }
    38. }
    In some short words this is what's happening:

    I hold my right mouse button, the speed doesn't change. I enter the 3d clock area and I keep holding right mouse button while I get out and the speed changes, I release the right mouse button while Im outside the 3d clock area the speed doesn't change. The animations do slow down so I know that the area clock/collider is working.

    Im using the latest version of this asset.

    Edit:

    I forgot to mention that I deleted the playmaker folder because I was getting this error(I don't use playmaker anyway):

    The type or namespace name `HutongGames' could not be found. Are you missing a using directive or an assembly reference?

    This error appeared in 4 different scripts, Im not that good at scripting so I couldn't figure out how to fix it.


    Thank you, and good luck with your computer!
     
    Last edited: Jul 27, 2015
  45. rerwandi

    rerwandi

    Joined:
    Dec 8, 2014
    Posts:
    544
    this doesnt seem to work with rewinding.
    when the timescale is negative number, the object doesnt scale / move backwards.
     
  46. Arx

    Arx

    Joined:
    Jan 28, 2014
    Posts:
    22
    Thanks for the tip, but the time.rigidbody2D.component is still null, even after calling time.CacheComponents()
    This might be because in CacheComponents, there's this:
    Code (CSharp):
    1. rigidbody2D.Cache(null);
    (line 754 of Timeline.cs)

    Edit:
    I solved this by manually calling
    Code (CSharp):
    1. shotInstance.GetComponent<ShotAmmo>().time.rigidbody2D.Cache(shotInstance.GetComponent<Rigidbody2D>());
    right after the instantiation. Doesn't look very elegant though.
     
    Last edited: Jul 27, 2015
  47. Arx

    Arx

    Joined:
    Jan 28, 2014
    Posts:
    22
    I have another problem, this time with particles.

    I have dust particles that are emitted from the feet of a character when he walks. These particles need to have Simulation Space set to World (this can be done via inspector in ParticleSystem component). Like this:
    dust_particles.png

    When I attach Timeline to this object with ParticleSystem, I can slow/accelerate/pause the particle system right away, but it is now always emitted in Local Simulation Space (which means the particles move as the character moves, which looks weird in case of dust cloud which should in general stay at the place where it was emitted, not move with player).
    The inspector of the ParticleSystem still shows World as Simulation Space, but it behaves as it it were in Local, no matter what I do.

    Any ideas how to fix this?
     
  48. ohbado

    ohbado

    Joined:
    Aug 13, 2014
    Posts:
    37
    Hi.
    I suffer from the strange issue.

    I am using Unity5.1.2f1.
    I added Timeline of Chronos to GameObject with ParticleSystem.
    It becomes impossible for me to detect ParticleSystem.IsAlive() == false from C# however through all eternity.
    ParticleSystem keeps returning IsAlive() == True like the zombi through all eternity.
    Of course, I am not making Loop of ParticleSystem effective.
    If Timeline is deleted from GameObject, IsAlive() == false can be detected.
    Is this a bug of Chronos?

    Please teach me the method of settlement.
     
    Last edited: Aug 4, 2015
  49. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    807
    I think this is an easy fix, but I can't test it right now. Should be fixed soon when I come back (Aug 8-9).

    I'll look into it, but usually, the null caching for the Rigidbody2D only occurs when you have a Rigidbody(3D) attached. Again, should be an easy fix when I come back.

    Hm, that's because Chronos uses manual resimulation to enable time effects. Is it possible for you to use isPlaying/isPaused/isStopped instead in the meantime? These are available in Timeline.particleSystem. I'll try to find a way to check IsAlive somehow when I come back.
     
  50. ohbado

    ohbado

    Joined:
    Aug 13, 2014
    Posts:
    37
    To our regret, it is not possible to deal by these.
    Because even if the reproduction of Particle ends, ParticleSystem(Timeline.particleSystem.isStopped) does not set isStopped=True by the automatic operation.

    Because I am using Particle-automatic destruction system, it is necessary to detect IsAlive().
    Example:
    http://answers.unity3d.com/questions/219609/auto-destroying-particle-system.html