Search Unity

Multi-Threading and GetCompoent()

Discussion in 'Scripting' started by Kryber, Apr 3, 2014.

  1. Kryber

    Kryber

    Joined:
    Apr 14, 2013
    Posts:
    92
    Hi :D . Is it possible use GetComponent in another thread?
     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
  3. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,531
    Quick and to the point.
     
  4. exiguous

    exiguous

    Joined:
    Nov 21, 2010
    Posts:
    1,749
    it is general not possible to use objects managed by unity internally (c++ side) in another thread. all you can do is calculating simple structs like vectors or filling a texture in the thread and when ready assign the result in the main thread to the desired target. this also means you must keep your own data structure (grid/tree) for pathfinding for example.
     
  5. Kryber

    Kryber

    Joined:
    Apr 14, 2013
    Posts:
    92
    LOL Thanks :)