Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Chronos – Time Control – Unity Awards Winner

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

  1. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi @ludiq

    I have a problem when I add a sound source to a GameObject at runtime and slow time the added sound source does not slow (lower pitch).

    But if I add a sound source to the GameObject it works fine ..

    Code (JavaScript):
    1. var footStep : AudioClip;
    2. private var audioFootStep : AudioSource;
    3.  
    4. function Start()
    5. {
    6.     audioFootStep = AddAudio(footStep, false, false, 0.6, AudioRolloffMode.Linear, 40, 1);
    7. }
    8.  
    9. function AddAudio(clip:AudioClip, loop: boolean, playAwake: boolean, vol: float, rollOff: AudioRolloffMode, maxDis: float, threeD: float): AudioSource
    10. {
    11.     var newAudio = gameObject.AddComponent.<AudioSource>();
    12.     newAudio.clip = clip;
    13.     newAudio.loop = loop;
    14.     newAudio.playOnAwake = playAwake;
    15.     newAudio.volume = vol;
    16.     newAudio.rolloffMode = rollOff;
    17.     newAudio.maxDistance = maxDis;
    18.     newAudio.spatialBlend = threeD;
    19.     return newAudio;
    20. }
     
  2. narkisos

    narkisos

    Joined:
    Mar 6, 2014
    Posts:
    4
    Does anyone have build errors while trying to export for Windows Store? Either 8.1 or 10!!!

    Assets\Chronos\Source\Dependencies\Reflection\UnityMethod.cs(76,23): error CS1061: 'System.Type' does not contain a definition for 'GetMethod' and no extension method 'GetMethod' accepting a first argument of type 'System.Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\Chronos\Source\Dependencies\Reflection\UnityMethod.cs(87,33): error CS1061: 'System.Type' does not contain a definition for 'GetMember' and no extension method 'GetMember' accepting a first argument of type 'System.Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\Chronos\Source\Dependencies\Reflection\UnityVariable.cs(44,34): error CS1061: 'System.Type' does not contain a definition for 'GetMember' and no extension method 'GetMember' accepting a first argument of type 'System.Type' could be found (are you missing a using directive or an assembly reference?)
    Assets\Chronos\Source\Dependencies\Reflection\Utilities\TypeSerializer.cs(31,16): error CS1501: No overload for method 'GetType' takes 3 arguments

    Unity 5.3.1f1
     
  3. p87

    p87

    Joined:
    Jun 6, 2013
    Posts:
    318
    Could I use the Recorder to save replays?

    I've looked at the documentation, I see the Recorder section, and about scripting custom Recorders. I'm assuming there is some way I can access all of the Snapshots?

    How often do the Recorders take snapshots by default?

    I'm hoping I can access these Snapshots and perhaps slow down the rate at which the Snapshots are recorded, then lerp between snapshots for a smooth replay?

    Is there a way I can load snapshots into the system somehow? (like send them over the wire as JSON or binary or something, then script the data back into snapshots on the correct objects)


    Thanks mate
     
    Last edited: Jan 15, 2016
  4. ahgr123

    ahgr123

    Joined:
    Jul 5, 2014
    Posts:
    8
    Hi, i have problem with physics. It doesnt really work how it should.

    For example if i make an area clock with timeline 0.1 and i throw a cube with rigidbody component into area clock the result isnt what one would expect. Cube should go through area clock and just travel slower when inside it, but instead of that, when cube enters area clock it does slow down but it falls down very soon after entering and falls down with normal gravity speed.

    I tried changing code i use to throw a cube and changed Time.deltaTime to Timeline.deltaTime but i get compiler error that it doesnt exist in that context.

    I am not a coder so any help would be appreciated.
     
  5. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    I think Time.deltaTime should be time.deltaTime
     
  6. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    Hi puzzlekings,

    Sorry for answering late, I somehow missed your post until now. What exactly happens with UnityEvent.AddListener(call)? Is there an error or an exception, or is it simply that the event isn't getting rewound? Also, where (on which object) / when (in which context in Curvy) is it called?

    Cheers,

    Lazlo
     
  7. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    This will be fixed in v.2.3! Note that custom recorders built from the inspector are not compatible with Windows Store builds, due to the lack of proper reflection.

    You shouldn't have to write any code for simply having a cube in the AreaClock. If your cube has a Timeline and a Rigidbody, Chronos takes care of the rest. Do you have any other script attached to it?
     
  8. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    Hi Phil,

    If you look at the thread, you'll see that this feature has been requested many times. Chronos cannot be used for replay. I have repeated many times that I'm trying to work on a proper Replay plugin in Unity, but it's very hard (if even possible) with the current API. Consequently, there is no way either to export the data as JSON (but that's done in my prototype Replay plugin).

    The recorders take snapshots at the Recording Interval property of the timeline. Chronos already lerps between snapshots for smooth rewind without too much memory pressure.
     
  9. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    You have to use CacheComponents on the timeline after adding/removing components at runtime.

    Code (JavaScript):
    1. var footStep : AudioClip;
    2. private var audioFootStep : AudioSource;
    3.  
    4. function Start()
    5. {
    6.     audioFootStep = AddAudio(footStep, false, false, 0.6, AudioRolloffMode.Linear, 40, 1);
    7. }
    8.  
    9. function AddAudio(clip:AudioClip, loop: boolean, playAwake: boolean, vol: float, rollOff: AudioRolloffMode, maxDis: float, threeD: float): AudioSource
    10. {
    11.     var newAudio = gameObject.AddComponent.<AudioSource>();
    12.     newAudio.clip = clip;
    13.     newAudio.loop = loop;
    14.     newAudio.playOnAwake = playAwake;
    15.     newAudio.volume = vol;
    16.     newAudio.rolloffMode = rollOff;
    17.     newAudio.maxDistance = maxDis;
    18.     newAudio.spatialBlend = threeD;
    19.     GetComponent.<Timeline>().CacheComponents();
    20.     return newAudio;
    21. }
     
  10. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi, I've tried that and it's still not working
     
  11. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    404
    Hi Lazlo,

    Basically if the event is added in the Inspector (Curvy uses these to trigger an event, say when an object reaches the end of the curve) then rewind simply fails to work. If the event is removed, then it rewinds ok.

    So I was wondering whether there was any potential conflict in Chronos that gets affected if the current object has an add listener call added?

    cheers

    Nalin
     
  12. ahgr123

    ahgr123

    Joined:
    Jul 5, 2014
    Posts:
    8
    cube only has attached timeline and rigidbody, area clock is set to 0.05..i attached gif so you can see what i described above..

    http://i.imgur.com/AQyhK8s.gif
     
  13. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    Just tested, works on my machine.

    Full code:

    Code (CSharp):
    1. #pragma strict
    2.  
    3. import Chronos;
    4.  
    5. var footStep : AudioClip;
    6. private var audioFootStep : AudioSource;
    7. function Start()
    8. {
    9.     audioFootStep = AddAudio(footStep, false, false, 0.6, AudioRolloffMode.Linear, 40, 1);
    10.     audioFootStep.Play();
    11.     GetComponent.<Timeline>().clock.localTimeScale = 0.5f;
    12. }
    13. function AddAudio(clip:AudioClip, loop: boolean, playAwake: boolean, vol: float, rollOff: AudioRolloffMode, maxDis: float, threeD: float): AudioSource
    14. {
    15.     var newAudio = gameObject.AddComponent.<AudioSource>();
    16.     newAudio.clip = clip;
    17.     newAudio.loop = loop;
    18.     newAudio.playOnAwake = playAwake;
    19.     newAudio.volume = vol;
    20.     newAudio.rolloffMode = rollOff;
    21.     newAudio.maxDistance = maxDis;
    22.     newAudio.spatialBlend = threeD;
    23.     GetComponent.<Timeline>().CacheComponents();
    24.     return newAudio;
    25. }
    Full setup:



    ("Rewindable" should appear as "Record Transform" to you).

    When I hit play, my audio clip plays at half speed (half pitch). If I remove CacheComponents, it doesn't work anymore.
     
  14. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    I just tested on my machine and cannot reproduce the bug. Can you confirm:
    • Your cube has these components and these only:
      • Transform
      • Rigidbody (non-kinematic)
      • Box Collider
      • Mesh Filter
      • Mesh Renderer
      • Timeline
    • Your area clock has these components and these only:
      • Transform
      • Sphere Collider
      • Mesh Filter
      • Mesh Renderer
      • Area Clock 3D
    And can you show me how your area clock is configured? For example:



    Do you do any additional scripting to the cube or area clock object?

    If with all of this I can't figure out what's wrong, I'm going to have to ask you to send me a sample project that triggers the bug you show in the gif.
     
  15. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Sorry, still don't work for me ..

    I've done as you say.

    I use a script to slow down time, when a button is pressed it sets a weapon wheel active ..

    Code (JavaScript):
    1. #pragma strict
    2.  
    3. import Chronos.Example;
    4.  
    5. public class SlowTimeWeaponWheelActive extends ExampleBaseBehaviour
    6. {
    7.     private var globalVarsScript : GlobalVars;
    8.     private var _slowTime : Chronos.Timekeeper;
    9.  
    10.     //              ----------------------------
    11.     function Start ()
    12.     {
    13.         _slowTime = GetComponent.<Chronos.Timekeeper>();
    14.         globalVarsScript = GameObject.Find("Global Vars").GetComponent.<GlobalVars>();
    15.     }
    16.     //              ----------------------------
    17.     function LateUpdate ()
    18.     {
    19.         if(globalVarsScript.WeaponWheelActive)
    20.         {
    21.             _slowTime.instance.Clock("Root").localTimeScale = 0.2;
    22.         }
    23.         else if(!globalVarsScript.WeaponWheelActive)
    24.         {
    25.             _slowTime.instance.Clock("Root").localTimeScale = 1.0;
    26.         }
    27.     }
    28.     //              ----------------------------
    29. }
    The code works fine, and all the enemy slow down, and sound effects that have an audio source already on the GameObject slow to, but any added in run time still won't slow down.
     
    Last edited: Jan 17, 2016
  16. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    When you "import Chronos", you don't have to prefix "Chronos." before every class. It's the equivalent to "using Chronos" in the C# tutorial.

    I'm not sure why you use GetComponent to get the Timekeeper; you should be able to simply use "Timekeeper.instance" from anywhere without a "_slowTime" variable.

    The code becomes simpler then:

    Code (JavaScript):
    1. #pragma strict
    2.  
    3. import Chronos; // THIS line is important.
    4. import Chronos.Example;
    5.  
    6. public class SlowTimeWeaponWheelActive extends ExampleBaseBehaviour
    7. {
    8.     private var globalVarsScript : GlobalVars;
    9.  
    10.     //              ----------------------------
    11.     function Start ()
    12.     {
    13.         globalVarsScript = GameObject.Find("Global Vars").GetComponent.<GlobalVars>();
    14.     }
    15.     //              ----------------------------
    16.     function LateUpdate ()
    17.     {
    18.         if(globalVarsScript.WeaponWheelActive)
    19.         {
    20.             Timekeeper.instance.Clock("Root").localTimeScale = 0.2;
    21.         }
    22.         else if(!globalVarsScript.WeaponWheelActive)
    23.         {
    24.             Timekeeper.instance.Clock("Root").localTimeScale = 1.0;
    25.         }
    26.     }
    27.     //              ----------------------------
    28. }
    I find it very odd that I don't get the bug but you do. There is unfortunately nothing more than I can do to help unless you send me a minimal version of your project where the bug occurs (ex: the simplest new project where you can reproduce the bug, with the code I sent you in the previous post).
     
  17. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    Version 2.3 has been submitted for review!

    Changelog:
    • New Timeline.rewindable property replaces Timeline.recordTransform
    • The rewindable property affects all built-in components (including animators) and custom recorders
    • Non-rewindable timelines have their computed time scales capped to a zero minimum
    • Non-rewindable timelines will therefore not trigger reverse occurrences
    • Animator recording is now limited by timeline recording duration and won't "leak"
    • Fixed bug where multiple extension classes were defined in the dependencies
    • Fixed bug where nav mesh agents would not turn when a timeline is attached
    • Fixed bug where nav mesh agents with rigidbodies would stagger after a pause
    • Fixed warnings for obsolete calls in Unity 5.3
    • Disabled CustomRecorder in Windows Store builds due to lack of reflection in .NET Core
    Fixed bugs reported by:
    @josh_s_dev @narkisos @FireMutant @Altia @tresordif
     
  18. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    Hi Nalin,

    No, Chronos doesn't check for listeners anywhere. This is an odd bug. Unfortunately, I don't have a Curvy license, so I can't test myself. :/ You'd have to try to debug the Chronos source yourself to see where and when it "stops" rewinding.
     
  19. ahgr123

    ahgr123

    Joined:
    Jul 5, 2014
    Posts:
    8
    Yes in both cases i have the exact and only the components you listed. My area clock setup is like this:

    area clock setup.jpg

    And i dont have any additional scripts for the clock..the only script there is, is to pick up cube and throw it...
     
  20. FanStudioUK

    FanStudioUK

    Joined:
    Mar 31, 2013
    Posts:
    24
    Placing Chronos under the plugins folder gives me lots of errors (we're using Javascript that's why we're doing this). Any ideas how to set it up correctly?

    Assets/Plugins/Chronos/Source/Dependencies/Reflection/Utilities/Extensions.cs(8,29): error CS0101: The namespace `Chronos.Reflection' already contains a definition for `Extensions'

    Thanks!
     
  21. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    I'll look into this with an exhaustive test on my side, I'll get back to you ASAP!

    This should be fixed in v.2.3, which just got released. Please update and let me know if it works!

    Speaking of which: v.2.3 is out! Changelog: http://ludiq.io/chronos/changelog
     
  22. Tony707

    Tony707

    Joined:
    Jun 15, 2015
    Posts:
    38
    Hi ludiq,

    Why each new version of the chronos plugin needs the last unity version ?
    Is there new features in Unity 5.3 that breaks chronos backward compatibility ?

    We would want to stay on Unity 5.2.3 but we can't install the new chronos bug fixes ?

    Thank you.
     
  23. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    Yes, the way particle systems are handled in 5.3 is different than in 5.2 (EmissionModules). Some other calls were obsolete, too.
     
    Tony707 likes this.
  24. The_Domaginarium

    The_Domaginarium

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

    I "somewhat" got the answer to my question based on what I've read in this thread, but I just wanted to make sure.Does Chronos support pausing audio? I mean, for example you pause the game in the middle of a dialogue, or when an NPC is talking. Will it pause the audio, or will it just "mute" it, causing the players miss what the NPC said because they "paused" the game but the speech continued playing?

    Thanks
     
  25. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    Yes, just like setting the pitch to zero in Unity will pause an audio source (and that's what Chronos does behind the scenes).
     
  26. The_Domaginarium

    The_Domaginarium

    Joined:
    Dec 11, 2012
    Posts:
    20
    That's good to know. Thanks!
     
  27. ahgr123

    ahgr123

    Joined:
    Jul 5, 2014
    Posts:
    8
    Won't be needed, I found out problem is in code for throwing cubes. It was migration... i forgot adding using Chronos; at the begging of the code. But now i get this error:

    error.png
     
  28. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    Timeline is not a static class, it's a component. You need to write:

    Code (CSharp):
    1. GetComponent<Timeline>().deltaTime
     
  29. Seank23

    Seank23

    Joined:
    Aug 4, 2015
    Posts:
    4
    Hi,
    I'm having a bit of trouble getting occurrences to work in the way I need them to. I'm fine with what the tutorial shows, having a gameobject instantiated going forward and then destroying it going backwards. I've implemented this and it works, however, I also need it to work the other way too: ie. The gameobject is destroyed going forward but instantiated going backwards again. My game has collectibles that when collected are destroyed but I want them to be re-instantiated in the same place on rewind.

    I came up with this code however it doesn't work:

    Code (CSharp):
    1.  
    2. public void RespawnCrystalOccurrence(GameObject passedCrystal, float[] pos)
    3.     {
    4.         time.Do
    5.         (
    6.             false,
    7.             delegate()
    8.             {
    9.                 GameObject crystalCopy = passedCrystal;
    10.                 Destroy(passedCrystal);
    11.                 return crystalCopy;
    12.             },
    13.             delegate(GameObject crystal)
    14.             {
    15.                 Vector3 instancePos = new Vector3(pos[0], pos[1] - 2, pos[2]);
    16.                 Instantiate(crystal, instancePos, Quaternion.identity);
    17.             }
    18.         );
    19.     }
    20.  
    The code in the first delegate (going forward) executes correctly as the crystal is destroyed however when rewinding - which is when I suspect the second delegate is executed - it throws this:

    MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.

    This does seem logical, as I am trying to instantiate something that doesn't exist. I am just unsure how I could get this to work correctly.

    Other than this, Chronos is a huge help to my game which is based off of Blinx: The Time Sweeper, where time manipulation is the main game mechanic.

    Thanks.
     
  30. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    Hi Sean!

    Blinx is an awesome game ;) Definitely a childhood inspiration for Chronos!

    How about, instead of destroying your collectible, you simply make it inactive on forward, and active on backward? If you had any code (e.g. incrementing the crystal count) that was in Awake/OnDestroy, you could move it to resp. OnEnable/OnDisable instead so that it still gets called.
     
    Seank23 likes this.
  31. Seank23

    Seank23

    Joined:
    Aug 4, 2015
    Posts:
    4
    Thanks for your reply.

    I actually got it working by instead of instantiating the crystal from the passed gameobject, which does not exist at this point, it takes the name of that gameobject and then iterates through the array that stores the crystals (the same array that I used to instantiate them in the first place) and instantiates a new gameobject from there. It works but for some reason every gameobject that's instantiated this way does not seem to co-operate with the rest of the game, maybe that's just something that I missed.
    Your suggestion does sound feasible and I will try it to see if it works any better. Thanks!

    P.S. - I agree with you on Blinx, it was definitely a revolutionary game for its time.
     
  32. ahgr123

    ahgr123

    Joined:
    Jul 5, 2014
    Posts:
    8
    I changed that but the script to pickup objects then didnt work..it generated errors That object reference is not set to an instance of an object...then i added timeline component to the player (player also has script for picking up objects) although i dont need it on player...now script for picking up objects works but when thrown into area clock the same issue is there...seems i will have to find another way of picking up and throwing objects...still thanks for the help
     
  33. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    You need to get the component on the GameObject that has the Timeline, of course!

    For example:

    Code (csharp):
    1. myCubeToThrow.GetComponent<Timeline>()
    I would recommend some Unity C# tutorials before moving on, you seem to lack some basic scripting experience.
     
  34. ahgr123

    ahgr123

    Joined:
    Jul 5, 2014
    Posts:
    8
    yep i totaly agree with you..as i said i am not programmer

    Good idea but i am not making a game in Unity..just using it to render and compile some kind of animation..
     
  35. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi @ludiq I've run into a little problem, I've made a RPG that when explodes slows everything within its bast radius down, it works fine but I just noticed if i kill the enemy while they are effected when they are re-spawn their Timeline shows as below ..

    Screen Shot 2016-01-28 at 19.32.21.png

    And I get an error ..

    Screen Shot 2016-01-28 at 19.34.57.png

    Can you tell me why please, thanks.
     
  36. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    on import in 5.3.2p1

    i get

    Assets/Chronos/Source/Dependencies/ReorderableList/Editor/ReorderableListControl.cs(1101,61): error CS0117: `DragAndDrop' does not contain a definition for `visualMode'
     
  37. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    What is the respawn code you use?

    Hm, seems like Unity 5.3.2 broke something in Rotorz' plugin, on which Chronos relies. I'll have a look and try to work it out with Lea, the maintainer of that project. Expect a fix in v.2.3.1,
     
  38. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi,

    When the enemy get killed I deactivate them, then send them back to the pool, then when they are called again I just reset the variables i need to in OnEnable()

    The enemy when re-spawn work as expected, as the first time.

    Code (JavaScript):
    1.     function OnEnable ()
    2.     {
    3.         globalVarsScript.updateEnemyList();
    4.  
    5.         i = 0; j = 0; t = 0; v = 0;
    6.  
    7.         loop01 = false; loop02 = false;
    8.  
    9.         _animator = GetComponent.<Animator>();
    10.         _navAgent = GetComponent.<NavMeshAgent>();
    11.         helper = GetComponent.<RagdollHelper>();
    12.         _slowTime = GetComponent.<Chronos.Timeline>();
    13.  
    14.         duration = 0.2;
    15.         killed = false;
    16.         lookWeight = 0;
    17.         seePlayer = false;
    18.         knockedDown = false;
    19.         longRangeShot = false;
    20.         helper.ragdolled = false;
    21.         _navAgent.enabled = true;
    22.         _animator.enabled = true;
    23.         helper.turnIntoRagdoll = false;
    24.         healthScript = GetComponent.<EnemyHealth>();
    25.         globalVarsScript.swatType1Alive[soldierNumber] = true;
    26.         healthScript.health = 100;
    27.  
    28.         weaponDummyClip.SetActive(false);
    29.         weaponDummyClip.GetComponent.<BoxCollider>().enabled = false;
    30.         weaponDummyClip.GetComponent.<Rigidbody>().isKinematic = false;
    31.         weaponBoxCollider = weapon.GetComponent.<BoxCollider>() as BoxCollider;
    32.         weaponBoxCollider.enabled = false;
    33.     }
     
    Last edited: Feb 3, 2016
  39. ponos_unity_004

    ponos_unity_004

    Joined:
    Dec 8, 2015
    Posts:
    1
  40. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi @ludiq I've got yet another problem ....

    When I try to ref Chronos in Awake() or OnEnable()

    Code (JavaScript):
    1. function Awake ()
    2. {
    3.     _slowTime = GetComponent.<Chronos.Timeline>();
    4.     _slowTime.navMeshAgent.speed = navSpeedThree;
    5. }
    I get this error

    NullReferenceException: Object reference not set to an instance of an object
    Chronos.NavMeshAgentTimeline.AdjustProperties (Single timeScale) (at Assets/Plugins/Chronos/Source/Timelines/NavMeshAgentTimeline.cs:55)
    Chronos.ComponentTimeline`1[T].AdjustProperties () (at Assets/Plugins/Chronos/Source/ComponentTimeline.cs:37)
    Chronos.NavMeshAgentTimeline.set_speed (Single value) (at Assets/Plugins/Chronos/Source/Timelines/NavMeshAgentTimeline.cs:18)
    FuturisticSoldierType1Cover.Awake () (at Assets/Scripts/0-AI/FuturisticSoldierType1Cover.js:293)

    Seem to only be able to access from Start()
     
  41. M0rrigan

    M0rrigan

    Joined:
    May 29, 2015
    Posts:
    29
    Hello, I've followed the tutorial to test Chronos in the 2D platform project, and I've noticed that there's a couple of bugs that occur with the pauser.
    1) If you press P for Pause the game, you'll notice that the spawner keeps creating enemies.
    2) While in Pause, if you press the keys designated to interact with the timekeeper, you'll notice (in the inspector) that you're actually changin the time scale of the global clock. When you hit again P to unpause you'll see the results.

    Now, I'd like to know what is the less invasive solution for such a situation. I think that setting Time.timeScale=0; is the most popular way to Pause a game in Unity, and I use that too.
     
  42. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    It seems like a problem with the solution you use for object pooling. I don't see anything specific to Chronos that could lead to a bug.

    You can call Timeline.CacheComponents() before accessing these in Awake. Note, however, that once you do this, you cannot change recording properties (i.e. rewindable, recordingDuration, and recordingInterval).

    Hi Morrigan,

    Until your post, I didn't realize that the default platformer demo included a pause button!

    As indicated here, Chronos is not currently compatible with Time.timeScale. It replaces the whole Unity time scaling system. You should refrain from using that property, as it may cause unexpected behaviour with physics.

    The tutorial shows the correct way to pause with Chronos, when you press "2" instead of "P". I should update it to specify that "P" should be ignored or removed.
     
  43. waynehelley

    waynehelley

    Joined:
    Feb 13, 2016
    Posts:
    2
    Hi there, this might be an easy one! I'm using unity's standard water asset. When I pause time, the water still looks like it is moving. Is there an easy fix to pause the water.

    Absolutely love what I have seen by far by the way. Really great work with the add-in.
     
  44. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    822
    Hi Wayne! Thanks for the kind words.

    Check in the default scripts if they use Time.deltaTime. Replace those calls with GetComponent<Timeline>().deltaTime, as indicated on the migration page. Of course, add a timeline to the object first.
     
  45. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @ludiq I'd appreciate you taking a look at my code to see if you can find a problem, because I can't seem to find one, thanks.

    ** Pool Code **
    Code (JavaScript):
    1. #pragma strict
    2.  
    3. import System.Collections.Generic;
    4.  
    5. var poolSize : int;
    6. var irobot  : Transform;
    7.  
    8. @HideInInspector
    9. var iRobotCount : int;
    10. @HideInInspector
    11. var iRobotStack : Stack.<Transform> = new Stack.<Transform>();
    12.  
    13. private var newy : GameObject;
    14.  
    15. //              ----------------------------
    16. function Awake ()
    17. {
    18.     _loadPool();
    19. }
    20. //              ----------------------------
    21. function _loadPool ()
    22. {
    23.     for (var c : int = 0; c < poolSize; ++c)
    24.     {
    25.         newy = Instantiate(irobot.gameObject);
    26.         newy.transform.parent = transform;
    27.         newy.transform.position = transform.position;
    28.         newy.transform.position.z += 0.1 * c;
    29.         newy.name = irobot .gameObject.name + "_" + c;
    30.         newy.tag = "iRobot_" + c.ToString();
    31.         newy.GetComponent(iRobot_AI_01).thisTransformsPool = this.transform;
    32.         iRobotStack.Push(newy.transform);
    33.         newy.SetActive(false);
    34.     }
    35.     iRobotCount = iRobotStack.Count;
    36. }
    ** Spawn Code **
    Code (JavaScript):
    1. #pragma strict
    2.  
    3. private var spawnTransform : Transform;
    4. private var iRobotPoolScript : PoolManageriRobots;
    5.  
    6. //              ----------------------------
    7. function Start ()
    8. {
    9.     player = GameObject.Find("Player");
    10.     iRobotPoolScript = GameObject.Find("Pool Manager iRobots").GetComponent.<PoolManageriRobots>();
    11. }
    12. //              ----------------------------
    13. function Update ()
    14. {
    15.     if (Input.GetKeyDown ("1"))
    16.     {
    17.         SpawniRobot();
    18.     }
    19. }
    20. //              ----------------------------
    21. function SpawniRobot ()
    22. {
    23.     spawnTransform = iRobotPoolScript.iRobotStack.Pop();
    24.     spawnTransform.parent = null;
    25.     spawnTransform.position = randomPosition();
    26.     spawnTransform.gameObject.SetActive(true);
    27. }
    28. //              ----------------------------
    29. function randomPosition () : Vector3
    30. {
    31.      var angle : float = Random.Range(0.0,Mathf.PI*2);
    32.      var V : Vector3 = new Vector3(Mathf.Sin(angle),0,Mathf.Cos(angle));
    33.      V *= Random.Range(20,40);
    34.      return V;
    35. }
    ** Return To Pool Code ** part of the iRobot AI script
    Code (JavaScript):
    1. #pragma strict
    2.  
    3. var thisTransformsPool : Transform;
    4.  
    5. private var irobotPoolScript : PoolManageriRobots;
    6.  
    7. //              ----------------------------
    8. function Start ()
    9. {
    10.     irobotPoolScript = GameObject.Find("Pool Manager iRobots").GetComponent.<PoolManageriRobots>();
    11. }
    12. //              ----------------------------
    13. function returnToPool ()
    14. {
    15.     transform.position = thisTransformsPool.position;
    16.     transform.parent = thisTransformsPool;
    17.     irobotPoolScript.iRobotStack.Push(this.transform);
    18.     gameObject.SetActive(false);
    19. }
     
  46. AlbertSwart

    AlbertSwart

    Joined:
    Oct 17, 2015
    Posts:
    15
    Hi liduq,

    I recently purchased Chronos and have a question related to an artifact that I am seeing when rewinding animations with root motion applied:

    I have a scene that is practical identical to the setup used in the Group B sample that comes with the product:
    - Timekeeper with two Global Clocks; "Root" and "Animation" where the latter is parented to "Root".
    - Timeline associated with the character and the Animation Global Clock, set as rewindable with duration of 90 and interval of 0.2.
    - Slider that controls the Global Clock "Animation" time scale.
    - Animation Controller associated with the character with a simple forward walking loop but with "Apply Root Motion" checked / on.

    When I play the scene all is well, the Animation clock time scale is 1 and the character starts walking forward as expected. After say 5 steps or so change the slider to a negative value of say -0.3 and as expected the character goes into rewind mode and starts walking backwards in slow motion - however when it gets close to the origin position (where the animation started) the animation freezes but the character 'slides' backwards an then 'pops' to its original position at origin.

    I have taken the sample scene you provided and checked the root motion on for Nathan (and switching off area clocks) to see if its something I am doing wrong, but in the sample scene I am seeing similar behavior.

    The bizarre thing is that it seems to only happen on the first rewind, i.e. once the character slides back and pops to its origin, when resuming the animation by setting the timescale to a positive value and then rewinding again it gives the expected behavior, i.e. it rewinds back to origin without freezing the animation or sliding and popping.

    Is this a known issue / is there a workaround for this?

    Thanks,
    Albert
     
  47. fizzd

    fizzd

    Joined:
    Jul 30, 2013
    Posts:
    21
    Hi Ludiq,

    I have spent some time considering buying your plugin, it looks great. I'm in the process of porting a game from Flash to Unity, and one particular level in my game is all about stuttering and glitching. In Flash, all I did was literally record frames from the buffer, and play them back. The effect is great, but I have a feeling it is much too memory intensive especially for mobile (recording 400x200 values at 60 fps) , and it might be better to instead have a time system where every object can calculate what values it's variables should have in at any time on the timeline - position, frame of animation, color, similar to the method Jon Blow used in Braid.

    If I am not mistaken, this is what Chronos does, right? Would you mind looking at this short video of my level, and telling me whether it can be recreated using Chronos? i.e. every flash, every particle effect, every frame in the animation, can be manipulated. Is that possible and how hard would it be to implement? I'm currently using 2DToolkit for animations, would it be easy to integrate so e.g. animations also remember what frames they were in?

    Thanks!



    (stuttering begins around 0:30)

    EDIT: Actually viewing the documents more, I can't see any examples of jumping between times, as I do in my game, rather than slowing down or rewinding. With the setup as it is, it should be easy to hack in though, right?
     
    Last edited: Feb 14, 2016
  48. codejoy

    codejoy

    Joined:
    Aug 17, 2012
    Posts:
    204
    So my forum search is not working pardon me if this was answered as it seems like a pretty easy answer but I got the asset and wanted to tinker on it and it gives me three console errors all in ExampleTimeColor.cs ones like there is no definition of MinMaxGradient. In my editor sure enough nothing of the sort pops up in code complete but I see it in the unity docs?! I am running Unity 5.1.1f1 if that matters? but I didn't see anything (then again its late might of missed it in my googling). (The other issues are with the colorOverLifetime and I think thats it... keeps asking if I am missing an assembly or reference?
     
  49. Puccini

    Puccini

    Joined:
    Sep 7, 2012
    Posts:
    1
    Hi @ludiq
    I've the same problem as @k.nakmura . The Custom Recorder inspector is not working.
    A couple of weeks ago I didn't have this problem so I could add variables to the Custom Recoder and then I've stopped changing settings from Chronos for a while. Now I can't add or remove variables, but the variables that I've setted before are working well. So , I suppouse it is something from the ReorderableListGUI. Any feedback will be very appreciated. Thanks for your time!


     
  50. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    I tried what you said in a empty project and it worked but only with adding 1 extra audio source, I add more than 1 to my GameObjects and it doesn't work on more than 1 added audio source.

    Code (JavaScript):
    1. #pragma strict
    2. import Chronos;
    3. var miniGun : AudioClip;
    4. var walking : AudioClip;
    5. var scream : AudioClip;
    6.  
    7. private var audioFootStep : AudioSource;
    8. private var audioMiniGun : AudioSource;
    9. private var audioScream : AudioSource;
    10.  
    11. function Start ()
    12. {
    13.     audioFootStep = AddAudio(walking, true, false, 0.6, AudioRolloffMode.Linear, 40, 1);
    14.     audioMiniGun = AddAudio(miniGun, true, false, 0.6, AudioRolloffMode.Linear, 40, 1);
    15.     audioScream = AddAudio(scream, true, false, 0.6, AudioRolloffMode.Linear, 40, 1);
    16.  
    17.     audioMiniGun.Play();
    18.     audioFootStep.Play();
    19.     audioScream.Play();
    20.  
    21.     GetComponent.<Timeline>().clock.localTimeScale = 0.2;
    22. }
    23.  
    24. function AddAudio(clip:AudioClip, loop: boolean, playAwake: boolean, vol: float, rollOff: AudioRolloffMode, maxDis: float, threeD: float): AudioSource
    25. {
    26.     var newAudio = gameObject.AddComponent.<AudioSource>();
    27.     newAudio.clip = clip;
    28.     newAudio.loop = loop;
    29.     newAudio.playOnAwake = playAwake;
    30.     newAudio.volume = vol;
    31.     newAudio.rolloffMode = rollOff;
    32.     newAudio.maxDistance = maxDis;
    33.     newAudio.spatialBlend = threeD;
    34.      GetComponent.<Timeline>().CacheComponents();
    35.     return newAudio;
    36. }
    This is the code I tested with and it only effects the first one to be added.