Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Ebil · May 09, 2013 at 12:39 AM · terraincoroutine

Start another thread for a function

Hello,

I have some big calculations to do and want the game continue to run while this calculations (generating a terrain) are running. How can I do that in c#?

Comment
Add comment · Show 16
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fattie · May 09, 2013 at 05:36 AM 0
Share

also check out Loom on the asset store

avatar image whydoidoit · May 09, 2013 at 06:16 AM 0
Share

@Fattie - it's not made to Asset Store yet :S It's just here: http://unitygems.com/threads/

avatar image Fattie · May 09, 2013 at 06:24 AM 0
Share

Ahhhhhhhhhhh! @whydo ... that clears things up:

https://www.assetstore.unity3d.com/#/content/7285

"I just stumbled on this,
http://www.youtube.com/watch?v=k$$anonymous$$0$$anonymous$$ubh0CWA
a package called Loom by $$anonymous$$ichiel Frankfort. His demo is great!"

namespace confusion, heh !

avatar image Fattie · May 09, 2013 at 06:25 AM 0
Share

also @whydo unrelatedly ...

http://answers.unity3d.com/questions/452773/how-to-use-yield-within-a-class-function.html

the whole world awaits your discussion there :-)

avatar image whydoidoit · May 09, 2013 at 06:35 AM 0
Share

Ah yeah, $$anonymous$$e this time :) Well I guess the name is obvious... :S

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Mortoc · May 09, 2013 at 01:41 AM

You can use the normal C# System.Threading library. Here's the official MSDN tutorial: http://msdn.microsoft.com/en-us/library/aa645740(v=vs.71).aspx

Just be careful not to call any Unity API functions from anything other than the main thread. Some basic data types are safe (Vector3, Color, etc), but don't call anything on GameObjects or Components.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Ebil · May 09, 2013 at 09:27 AM 0
Share

Well but I have to create a Game Object :/ I already heard of that method but heard its not safe to use :/

avatar image Mortoc · May 09, 2013 at 10:00 PM 0
Share

Yes, you won't be able to do anything multithreaded that accesses a game object. I suggest you do your calculations off-main and then just apply to the gameobject on the main thread when you're done (coroutines are helpful for that)

avatar image Ebil · May 09, 2013 at 10:04 PM 0
Share

Yeah I figured out and whydoidoit told me that already. $$anonymous$$akes it a little hard to change the whole code ~_~

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

14 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

ExportTerrain doesn't work 1 Answer

Procedurally generating terrain? 0 Answers

Get Height of Terrain in Script 1 Answer

Terrain Painting Script 0 Answers

Terrain Shading 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges