Using C# Threads in Godot for a Typing Effect [Godot Tutorial]
Polysthetic
How to use C# threads in Godot and some things to watch out for like locking references and terminating threads safely. I demonstrate the use of a thread with a typing text effect, but I use separate threads for other things, such as the HUD indicator of the aliens off-screen.
ā±ļø Timestamps: 0:00 Intro 0:40 Setting up the script 1:38 Writing the first loop for typing 4:28 Locking references 5:16 Writing the blinking cursor effect 7:40 Terminating threads safely 11:00 Conclusion
I'm not really sure why not locking the string references in this case is unsafe, but it has been my experience. As I understand it, the string should be fully constructed first, and then assigned. Assignment is an atomic operation in C# so should be thread safe. Moreover, the different threads are not mutating the same objects, rather each thread writes to and reads from data that the other thread reads from and writes to, respectively. If you have any ideas, please let me know in the comments.
š¶ Music tracks from:
- Le Metroid - Black Hole
- Provided by Lofi Girl
- https://www.youtube.com/watch?v=eNSKKq34qKM
You can also visit me at: WEBSITE š https://polysthetic.com THREADLESS š¶ļø https://polysthetic.threadless.com DRIBBBLE š https://dribbble.com/polysthetic YOUTUBE š„ https://youtube.com/c/polysthetic AUDIOMACK š¼ https://audiomack.com/polysthetic INSTAGRAM šø https://www.instagram.com/polysthetic/ MASTODON 𦣠https://mastodon.online/@polysthetic TWITTER š¦ https://twitter.com/polysthetic ... https://www.youtube.com/watch?v=y4q8AeZjpzk
58319200 Bytes