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

[RELEASED]iS.CentralDispatch - a Multi-Threading Framework

Discussion in 'Assets and Asset Store' started by QI, Jul 28, 2016.

  1. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Screen Shot 2016-09-28 at 10.29.35.png

    iS.Central Dispatch - a Multi-Threading Framework for Unity3D

    Does your game needs to do heavy calculations like terrain generating, complicated AI, or data analyzing ?

    All of these complex tasks will spend a lot of time on processing, and not possible to be done at runtime since Unity does not have support for Multi-Threaded programming.

    If you are looking for a Multi-Thread framework, iS.CentralDispatch is exactly what you want !

    Please try our demo to see how iS.CentralDispatch gives you the power to do parallel computing in Unity.

    Notable Features :
    1 : Examples included to help you get start quickly.
    2 : Start using threads in Unity with only few lines of code.
    2 : Supports All Platforms (Expect WebGL).
    3 : Performance optimized for mobile.
    4 : Coding clearly uses C#, flexible and modular with source code included.
    5 : Full detailed documentations included.
    6 : Full email real-time technical support (English only).


    Documentation and API Reference of last version(1.0f1) are uploaded as attachment.



    Official Webpage and Online Demo : Click here
    Support email: support@spinachelectr.com
     

    Attached Files:

    Last edited: Sep 28, 2016
  2. NamNH1990

    NamNH1990

    Joined:
    Mar 16, 2015
    Posts:
    8
    Can this package used in Unity 5.14f ? Because of some problems in uGUI system, my projects can't upgrade to Unity > 5.2.
     
  3. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    I think it should works in all version of Unity after 4.0, but I only submitted to Asset Store using 5.4.
    I will submit an older version support to Asset Store now, it should available soon.

    Thanks for your reply :)
     
  4. NamNH1990

    NamNH1990

    Joined:
    Mar 16, 2015
    Posts:
    8
    Thank you for fast reply! My game's currently run too slow cause of loading to much asset and calculating to much. Hope this will solve my problem. Waiting for the 5.1 version.
     
  5. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    I already uploaded and waiting for Asset Store's review :)
     
  6. NamNH1990

    NamNH1990

    Joined:
    Mar 16, 2015
    Posts:
    8
    Asset Store's review so long! still wating...
     
  7. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Yeah I didn't have any news, too.
    They usually review updates in one ~ two days. I am really sorry for the inconvenience :(
     
  8. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hey :)
    Glad to tell you that the new version is available now. Please check it out here
     
  9. NamNH1990

    NamNH1990

    Joined:
    Mar 16, 2015
    Posts:
    8
    I've purchased, and reading the document... I'm new to Multithread , hope you'll help me here!
     
  10. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Don't worry, just post your question here and I will try to help you with it.

    You can also e-mail support@spinachelectr.com if you have any trouble with iS.CentralDispatch or Multi-Threaded programming. Me and my support team will try our best to help.

    Thanks for support by the way :)
     
  11. Naphier

    Naphier

    Joined:
    Aug 4, 2014
    Posts:
    114
    Any chance you could post the documentation somewhere so we can look at it before investing? Thanks!
     
  12. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hello,
    Yes, of course. I uploaded it to the main post.
    Thanks for you reply :)
     
  13. Naphier

    Naphier

    Joined:
    Aug 4, 2014
    Posts:
    114
    Thanks! That's helpful.
     
  14. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    You're welcome :)
     
  15. 3Dreadnoughts

    3Dreadnoughts

    Joined:
    May 12, 2014
    Posts:
    2
    I am sorry for asking this, but when you say all platforms does that includes 'Windows Store' as well? As i need it for Windows Store development mainly.
     
  16. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hello,
    I haven't had a chance to test on Windows Store yet, since I mainly using macOS. I am not sure if it will supports Windows Store platform or not. But I think it should work since it works perfectly on Windows, iOS, Android, macOS and Webplayer(Those are the platforms we have tested). And the reason why it cannot running on WebGL is because JavaScript does not support Multi-Threading.
     
  17. 3Dreadnoughts

    3Dreadnoughts

    Joined:
    May 12, 2014
    Posts:
    2
    Thanks for your quick answer. Until now i was using a simple multi-threaded way found across internet (loom), but as soon as i am targeting to Windows Store i got some errors as it doesn't support some base function such as "Thread.Sleep()" and "ThreadPool" class. Are you using those functions? Could you make a simple test for Windows Store, like running something on a new thread and then run something else back to main thread ?
     
  18. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hello,
    We are working on testing it, I will let you know when we have any result.
     
  19. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hello there,
    I am sorry for getting back late. I using a Windows version of Unity editor and switch to Windows Store, is runs good in editor. But we are not able to build since we not owning a Windows Developer ID(such thing). I already asked one of my friend to test it, still waiting for the result.

    Another information is that iS.CentralDispatch is not depends on Thread.Sleep and ThreadPool.
     
  20. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Screen Shot 2016-10-12 at 11.21.07.png
    Thanks for the e-mail from Aris Semertzidis,
    We just noticed that iS.CentralDispatch will NOT WORK for Windows Store platform.
    Please be careful if you are planning development on Windows Store with iS.CentralDispatch
    It will works good in editor but you are not able to build.
     
  21. Ninekorn

    Ninekorn

    Joined:
    Aug 12, 2016
    Posts:
    66
    Hello QI. I would love To know if thé thread.sleep method is available While running à thread From your package.
     
  22. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hello there,

    Yes, of course, you can call iSCentralDispatch.PauseThread to pause a thread.
     
  23. Ninekorn

    Ninekorn

    Joined:
    Aug 12, 2016
    Posts:
    66
    Thank you for your fast response!I got another question though before I invest. I used thread ninja and dispatcher from the unity asset store. If I tried them both correctly, thread ninja allows for multithreaded coroutines which are not real multithreads. I probably still will end up using ninja thread in the future though. As for dispatcher it seems that it can instantiate objects from another thread but I couldn't get the script to pause. So the question is can your script make It possible to instantiate objects in another thread as in using the instantiate method from outside the main thread?
     
  24. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hello,
    Sorry you can't do this since Unity does not allow you to do instantiate outside main thread. For now you can spawn massive GameObjects in coroutines and setup in your thread.
    We will ship a new method in next update to allow you call iSCentralDispatch.Instantiate to instantiate new GameObject from your thread, but internally used coroutines as well, but without huge drops of performances.
     
  25. Ninekorn

    Ninekorn

    Joined:
    Aug 12, 2016
    Posts:
    66
    Wow I can't wait for the next update. I will be waiting patiently for your next update announcement! Thank you again
     
  26. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    You are welcome :)
    Thanks for your support.
     
  27. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hello :)

    I am glad to be here to let you know that the development of our latest update of iS.CentralDispatch just completed and submitted to Asset Store. We shipped many new features in this update including 3 major updates. N1.1.png

    The new version is reviewing by Asset Store now, please be patiently wait. It will be available soon.

    Thanks for reading and thanks for your support. :)
     
  28. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Version 1.1 update is available on Asset Store now :)
     
  29. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @QI When you say every platform do you mean WebPlayer as well?
    Also, are we able to use the threads to update Unity UI/Sprites?
     
  30. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hello,
    Yes, WebPlayer is supported(but WebGL is not supported, we are working on supporting it).
    You can process sprite's original image data in your thread(load, paint), but you are not able to make change to sprite component since this requires Unity API call, but iS.CentralDispatch can dispatch this call in main thread so you can do this in your thread, for a little more cost. Also since iS.CentralDispatch 1.1 added supports to async instantiating, you can instantiate sprite's GameObject via your dispatch without issuing main thread dispatch.

    Thanks for replying.
     
  31. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @QI Could I ask more specifically, when I say update Unity sprites, in my case instead of using Unity's Animator component, I have a function that changes the Unity sprite on a UI Image component every second to create an animation similar to a spritesheet with frame delays. Because Unity does this on the main thread that animation freezes whenever there is any heavy load on the main thread. Would it be possible to do the animation the way I have it now in a separate thread, or would that still have to fall on the main thread?
     
  32. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hello,
    I am afraid you can not do this. Even if you update a sprite in another thread, if main thread is blocked every is blocked. Yes, of course you changed sprite it self, but since main thread is blocked the application is not able to render. What will user see is still a blocked graphic.
    What we should do with multi-thread is to trying to avoid blocking main thread.
     
    Ben-BearFish likes this.
  33. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    Before I buy, could you provide more information regarding the 'Main Thread Load-Balancer' feature?

    Specifically. How it works. What it can do... What it can't... Some information how much work is required to impliment it in my project?
     
  34. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hello there,

    iS.CentralDispatch can help you working with multi-threaded tasks in Unity easier. It helps you to start, stop, manage and communicate between threads. In Unity, almost everything should back to main thread in order to render on screen, the 'Main Thread Load-Balancer' introduced in the latest update is here to prevent main thread from get blocked by heavy syncing tasks(sending datas back to main thread) pushed from other threads.

    In a short word, iS.CentralDispatch let you create your own async tasks with multi-threaded programming in Unity with few API call while keep everything in main thread in order.
     
  35. Brian-FJ

    Brian-FJ

    Joined:
    Apr 23, 2013
    Posts:
    9
    Hi, I've recently started using Central Dispatch and it's going quite well. At the moment I only use it to smooth some long initialisation in our loading screen so we can show a animation relatively smoothly.

    However I have noticed a couple of times that I've frozen in iSCentralDispatchRuntime.Update in the lock around registerredTasks. I found this strange as I don't actually call ThreadedInstantiate anywhere. This was in the editor and the last time I noticed it I was purposely stopping and starting the game to check for any freezes or problems in the loading screen. I saw the lock immediately after starting the game. Is this something you've seen before or is it something I can solve somehow?

    Thanks for you help,
    Brian :)
     
  36. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hello there,
    I am sorry for your problem. Could you please tell me which version of Unity3D are you using ?
    The "lock()" in iSCentralDispatchRuntime.Update is called even if no ThreadedInstantiate is requested. And I think iSCentralDispatchRuntime itself won't keep it locks forever.

    I personally use iSCentralDispatch on my projects these days and had never faced this kind of problem.

    Could you please provide me more info here :
    Like does it freezes every time or randomly ?
    And it there any specific steps to reproduce the freeze ?
     
  37. gaiastellar

    gaiastellar

    Joined:
    Nov 8, 2013
    Posts:
    57
    Hi,
    Does this allow the unity API to be multithreaded?

    Thanks
     
  38. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Yes, iS.CentralDispatch is there to help you interacting with Unity API in threads.
    So with iS.CentralDispatch you are able to start off your thread, and use Unity3D API from it.

    But in fact, since Unity3D API is not thread safe, there's no way to actually call it outside main thread.
    And that's why iS.CentralDispatch here to help :)
     
  39. siliwangi

    siliwangi

    Joined:
    Sep 25, 2009
    Posts:
    303
    I am also getting a 'deadlock' or unity freezes, how to reproduce is by play and stop a couple times "iS.CentralDispatch\Examples\Scenes\Example 2 - Counting Numbers" (especially in the middle of counting numbers). This is a unity's issue and already been long logged eversince 5.3.0a4.

    Please vote for this issue in here.
     
  40. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hi @vortexilation
    I noticed this issue when developing iS.CentralDispatch and wrote some code in the runtime component to stop all thread execution after GameObject being destroyed.
    I also just noticed this bug still occur, I voted this issue but I will try to find a workaround and update the package.

    Thanks :)
     
    siliwangi likes this.
  41. MarekM2

    MarekM2

    Joined:
    Dec 9, 2013
    Posts:
    12
    Hi Ql,
    I'm wondering - does this plugin somehow allow calling Unity apis in threads other than main? I'm creating set of algorithms heavily using raycasting and path detection and since I have to code it on the main thread, FPS drops sometimes. Can your plugin somehow help me out with that?

    I saw your answer above and I don't get it :). In the scenario I'm describing, so for example doing a raycast - will the raycast unity api be called on the main thread, or the background one?
     
    Last edited: Nov 4, 2017
  42. QI

    QI

    Joined:
    Oct 27, 2012
    Posts:
    229
    Hi @impious666
    Since physic engine works tidy depends on timing and syncs, there is no way to call the not thread-safe APIs outside main thread.

    So what iS.CentralDispatch can do for you in this case are :
    1. Provide a way for you to create ray cast and access ray cast result in threads.
    2. Call as much as cast in main thread as long as FPS drops. The result is a longer time for your algorithms to run but a always smooth gameplay.
     
  43. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    119
    Hi, I read your plugin can allow the Unity API to be multithreaded, and that's very interesting.

    More specifically, could your solution be used to do WWW operations, like loading a huge texture in a secondary thread, so avoiding the typical hiccups/breaks in the main thread? I mean calling methods like:

    www.LoadImageIntoTexture(tex);
     
    mikaelK likes this.
  44. mikaelK

    mikaelK

    Joined:
    Oct 2, 2013
    Posts:
    284
    I purchased this and I don't know why, but dispatchmainthread doesn't work. I put simple debug.log inside and nothing. Does this plugin work with editor scripts?
     
  45. Trortheon

    Trortheon

    Joined:
    Dec 28, 2016
    Posts:
    1
    Tried this in my project and I'm getting periodical exceptions (maybe once in 10-20 runs) when trying to call methods like LifeReport from the threads. Seems to be currently unusable in Unity 2019.