"# UnityCustomCoroutine"
Custom Coroutine Classes to perform yielding of coroutine that has the following feature:
- waits until all nested/inline coroutine has completed it's execution
- appending of tasks and starts them sequentially in order
- easy to manage code and enhance readability
This package contains the following components
- CustomCoroutine.cs (Custom Coroutine Classes)
- EventManager.cs (Custom classes for managing multi-cast delegates)
- TestClass.cs (Class to test Task.cs and delegates)
- Utility packages contains
- Debug.cs (debug wrapper class that hides logging on release build)
- FpsCounter.cs (Fps counter display)
- Profiler (Show memory usage)
Pre-requisite: Unity3d version 5++ software download it at http://unity3d.com/get-unity.
-
Clone it to your working directory,
-
Open the project that you have clone using Unity3d.
-
Run the StartScene.
-
Examine TestObject prefab and console for more info. (Can also see the Scripts attached to it).
Run the project and see TestClass.cs for more details on how to use it
#1 - Add all custom coroutine and start when needed CustomCoroutine t = this.CreateCustomCoroutine (DoSomethingCoroutine ()); t.AddCoroutine(DoAnotherCoroutine()); ... t.Start();
#2 - Start coroutine immediately this.StartCustomCoroutine(DoMyCoroutine());
#3- Wait for coroutine to Complete IEnumerator CoroutineFunc() { ... yield return this.StartCustomCoroutine(MyCoroutine()).UntilDone;
or
CustomCoroutine t = this.CreateCustomCoroutine (MyCoroutine ()); t.Start(); yield return t.UntilDone; }
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
First created 31/05/2016 by Edwin. Cheers.
The classes was made with some references from online resource, as well as crediting my mentor Muxian Wu.
References: http://answers.unity3d.com/questions/1040319/whats-the-proper-way-to-queue-and-space-function-c.html http://twistedoakstudios.com/blog/Post83_coroutines-more-than-you-want-to-know
http://blog.zephyr-ware.com/delegates-and-events/ http://www.codeproject.com/Articles/20550/C-Event-Implementation-Fundamentals-Best-Practices
The MIT License (MIT) Open Source Free