VisionTimer [RELEASED]

Please note: VisionTimer has been canceled and is no longer sold, marketed or supported.
Previous customers can still download a backup of the final version from Asset Store.
A PDF version of the manual for backup purposes can be found here:
http://www.visionpunk.com/content/assets/visiontimer/manual/VisionTimerManual.pdf

New version submitted to the Asset Store: 1.0.1. This is a small bugfix update.

  • Fixed broken ā€œTimersā€ gameobject being visible in Hierarchy when not running in Debug mode.


demo:http://www.visionpunk.com/products/visionTimer/webplayer/demo.html
hi,I saw in the demo scene in the picture above, I ask, what does it do? Or is it just a picture? It does not have any interaction or reaction?

Cool Asset. This plugin is reliable, cheap and saved me a lot of time with my current mobile project.

Thanks,

Peter.

does the delegate callback generate garbage collection on mobile?

If you generate them on the fly in an Update loop then it will generate lots of garbage. What I did is predefine them in an Awake Or Start Routine and then they are static:

private vp_Timer.Handle deformedTimer;
	public float deformedTime = 30.0f;

  	void Awake ()
   	{
		deformedTimer = new vp_Timer.Handle();
   	} 

   	public IEnumerator DeformBig()
	{
        yield return new WaitForEndOfFrame ();
 
    	vp_Timer.In(deformedTime, delegate() {
			
        	//Make it Big!
			
		}, deformedTimer);   		
	}

Peter.

Hi VisionPunk,

First off thanks for making this asset. It looks like it’s going to be very useful.

One feature request I have (At least I can’t find the functionality) is a way to set intervals to a random amount of time clamped between a min and max value. This would be useful for all sorts of events from keeping ambiance sounds naturally spaced, to instantiating objects at random times.

Is there an easy way to do this that I’m just not seeing?

Thanks

Random intervals, is there a built in way to set a random interval based on a low,max argument?

Ie I want a time to fire no less than ever 5 send and no more than ever 30 seconds, but after each firing of the timer I want a new random set between those 2 low / max figures. Am I making any sense?

This image is just the sales art / icon for the product. It does not have any functionality, no :slight_smile:

Glad to hear that!

I have tried to make sure that the system itself generates very minimal garbage. The timers are put in a pool manager and recycled. If they refrence delegates, the delegates themselves may ofcourse generate garbage, depending on what you choose to put inside them.

hi @dl_studios and @WarHead. Random intervals are not currently supported. Excellent idea though. I’ll make a note of this.

Hello,

A new version of this asset is available in the Asset Store. This is an update for compatibility with UFPS, adding new helper functionality for slow motion, pausing, physics and level loading. To see the slow motion functionality in action, have a look at the Ultimate FPS online demo (head over to the bubble pickup with a clock icon in it). The UFPS slow motion effect is also shown in this video and this.

New features

  • vp_TimeUtility.TimeScale: A helper property to set the global timescale and adjust the fixed timestep accordingly. It can be used in place of ā€œUnityEngine.Time.timeScaleā€ to get proper physics in slow motion.
  • vp_TimeUtility.FadeTimeScale: A method that interpolates the time scale to a new value over time. A typical value for ā€˜fadeSpeed’ is ā€˜0.2f’ (a value of ā€˜1’ will be instant). PLEASE NOTE: This method must be run every frame inside an Update method. It will have virtually no effect if run a single time. For more info on how to do slow motion effects, see this manual section.
  • vp_TimeUtility.Paused: A helper property to set or get the application pause state by manipulating timescale. This property will restore timescale to the correct one if game was paused and then unpaused during slow motion.
  • vp_TimeUtility.AdjustedTimeScale. This is a multiplier developed for a small number of UFPS physics cases where physics code would get weird if the fixed timestep was increased in ā€œEdit → ProjectSettings → Timeā€ (a method commonly used for making the physics engine less taxing on mobile platforms). Consider experimenting with it if you run into issues when manipulating the Unity fixed timestep.
  • vp_Timer.Handle.CancelOnLoad: This new property sets whether the event associated with this handle should be canceled upon level load. Default is true.
  • Finally, the manual and releasenotes for visionTimer has moved online.

Note to users of UFPS : Ultimate FPS
If you wish to use visionTimer with UFPS, you should delete the below UFPS files. Instead, your project should use the files with the same names from inside the visionTimer package. The ā€œvp_Timerā€ and ā€œvp_TimerEditorā€ classes are actually identical between the packages, but the ā€œvp_TimeUtility.csā€ from visionTimer has many extra properties.

UltimateFPS\Scripts\Core\Utility\vp_Timer.cs
UltimateFPS\Scripts\Core\Utility\vp_TimeUtility.cs
UltimateFPS\Scripts\Core*Editor*\vp_TimerEditor

Cheers

Cal

1 Like

Hi there, VisionPunk.

First of all, thanks for the asset.

I’m trying to use it in a kind of whack-a-mole game, but I don’ figure out how to use the plugin to make the moles disappaear after ā€˜x’ time. Could you give me a hand on this?

Right now, I’m using a timer to show them:

vp_Timer.In (Random.Range (0.5f, 3f), ShowMole, 1);

I run the same line inside the ShowMole method so they keep appearing in a random time interval, but I’m not really sure this is the best way to make what I want either. At least, it’s working ^_^’

Any help would be very appreciated.

My above example gives problems if you wan’t to cancel timers where the execution code lives inside a coroutine. it will sometimes after the timer is cancel just executed. A regular function like in the following example doesn’t have this problem:

private vp_Timer.Handle deformedTimer;

public float deformedTime = 30.0f;

void Awake ()	
{
	deformedTimer = new vp_Timer.Handle();
} 

public IEnumerator DeformBig()	
{
	yield return new WaitForEndOfFrame ();
	
	MakeItBig ();

	yield return 0;
}

private void MakeItBig ()
{
	vp_Timer.In(deformedTime, delegate() {
	
		//Make it Big!
	
	}, deformedTimer);       
}

Peter.

Just take my Second example and and replace ā€œ//Make it Bigā€ with the code where the moles should disappear. Now call the coroutine and the should disappear after 30 seconds. And you can also do the Random.Range inside the coroutine with deformedTime before it starts the function MakeItBig.

Thank you very much!

Ok,

I tested a a day further and on my mobile IOS project it happens frequently that if I cancel a timer (lets say now) and start it a minute later and cancel it again after a minute that the code inside the delegate is 1 minute later just executed. I make use of 12 timers and a maximum of 5 can run at once. I discovered this behaviour due a debug.log line inside my delegate functions.

I used this framework to restore from a PowerUp in my game after some time has expired and it happens frequently that my game logic needs to cancel the restore operation because the player took for example a different powerUp.

I’m not sure but think that this problem is related how Unity caches components and calls on a IOS build (statics)? :face_with_spiral_eyes: It also happens inside the editor.

Everything is working fine as long I don’t cancel timers.

For now I implemented a far more simple coroutine timer based system which don’t gives any problems inside my code.

Peter.

Hi guys, sorry for not replying here sooner. Somehow my email notification for posts in this thread had gone disabled. Thanks for reaching out regarding this bug. It’s definitely something that needs fixing! I will post here as soon as I have a fix.

Hi just wondering how I go about adding to the timer (like add 10 seconds from a pickup)

any help ?