Linked Questions

1 vote
1 answer
2k views

Unity3D: Making heavy calculation on separate thread [duplicate]

So, I've created a program with Kinect as its input. As you know, Kinect will send the data 30 frame per second. I have a model that will mimic Kinect's input motion, so on Update() I read the ...
Richard's user avatar
  • 11
17 votes
3 answers
18k views

Unity coroutine vs threads

Whats the difference between a coroutine and a thread? Are there any advantages of using one over the other?
StrengthPlusPlus's user avatar
6 votes
3 answers
5k views

How to run a long task without freezing my game?

I have a component that is in charge of generating a level at runtime, and this is an operation that takes quite some time. As a consequence, I experience a hang when this operation is executed (when ...
aybe's user avatar
  • 773
0 votes
1 answer
3k views

Resolve Unity error about "Constructors and field initializers" on the loading thread

The code below is producing an error message I don't understand: Constructors and field initializers will be executed from the loading thread when loading a scene. Don't use this function in the ...
Nathan's user avatar
  • 11
1 vote
0 answers
3k views

Unity job system - long running task

I have a long running task (250ms+)that I want to pick up a resultant array from. This job is a path finding service that should run periodically in the background. It's all prototyped in another ...
wax_lyrical's user avatar
2 votes
1 answer
1k views

Animate Loading Screen During CPU-Heavy Scene Load

I have a scene with lots of lightweight objects and one that takes anywhere between 10 and 45 seconds to load. At a high level, the Awake method does... Query database For each result do some (fairly ...
Basic's user avatar
  • 1,242
0 votes
2 answers
1k views

Display loading screen after scene change but wait for coroutine to finish

I thought I'd understood how coroutines work but I'm still experiencing problems getting them to run when I want them to run: There are two scenes in my game: The main menu one and a game one. The ...
Neph's user avatar
  • 267
0 votes
1 answer
1k views

How to use Unity job system to do background work spanning multiple frames?

I have a slow level generation algorithm that freezes the main thread when it runs. I found this post which is exactly the same problem, but predates the Jobs system. All the jobs examples I found are ...
arcadeperfect's user avatar
2 votes
1 answer
772 views

Can you use a standard multi-thread if only reading unity objects?

First of all I know about coroutines and how to use them (they're awesome). A friend of mine was telling me about the way the he implemented his saving system in a game he was working on, after ...
user3797758's user avatar
  • 3,631
-1 votes
2 answers
387 views

Control Unity Game loop to sync with external hardware/software

We would like to run the Unity Game Loop in sync with external hardware and applications running on a different computer. We want to arrive at something that work similar (but does not have to be ...
Dr.YSG's user avatar
  • 179
1 vote
1 answer
417 views

Why does my game crash on startup?

I'm very new to networking, so I've been trying to develop my own server and client to use with Unity. I did some copy and pasting to learn the basics, but now I'm trying to get a real grasp of how to ...
schnondle's user avatar
1 vote
1 answer
356 views

Wait for a function to return value without impacting framerate

I'm looking to do some possibly heavy calculation in my game. An agent in my game needs to evaluate up to 1000 objects while performing heavy calculations to select his next job. I want to either ...
caleidon's user avatar
  • 561
0 votes
1 answer
132 views

Showing the steps of a level generation process over multiple frames

I seem to be misunderstanding part of Unity. I'm generating a maze similar to the one here: http://journal.stuffwithstuff.com/2014/12/21/rooms-and-mazes/ I put the whole of the generation in ...
Jesse Williams's user avatar
-2 votes
1 answer
129 views

How do I run code in sync without interrupting the main() method?

I have three activities: Attack Troops Training Gathering Resources I want to attack and train troops while I am gathering resources. I want these activities to run in sync. Here is an example of ...
The Develop3r's user avatar
0 votes
1 answer
116 views

What aspect of performance should I be optimizing my code towards? (asynchronous chunk modification)

Preface I realized that the root of my question is a little simpler than all of the details below make it out to be. All other things being equal, what is the most important system aspect to optimize ...
MPStoering's user avatar

15 30 50 per page