All Questions
377
questions
0
votes
2
answers
68
views
How to make this IEnumerator generic in a proper way?
Ive got a following coroutine in unity:
IEnumerator DoActionUponReachingRangeCoroutine(Range range, Delegate action, params object[] args)
{
yield return new WaitUntil(() => range....
1
vote
0
answers
33
views
Unity Coroutine closes all the threads and the debugger turns off
I am writing a visual novel and i have a problem with saving my data. When i save the data in a savefile and then change the script, the old script remains. Like i told my character to move left, then ...
1
vote
0
answers
42
views
What is causing my coroutine not to start?
I'm trying to spawn a circle to show the splash radius of a projectile but the coroutine to destroy the object is not running.
The prefab is spawning in like I expect it to but it is not destroyed.
...
1
vote
0
answers
56
views
Is it possible to change a value passed by reference within a coroutine?
I'm essentially trying to make a working version of this:
public static Coroutine AnimateValue(this MonoBehaviour behaviour, ref float value, float endValue)
{
return behaviour.StartCoroutine(...
1
vote
1
answer
32
views
How to execute a coroutine when user clicks on a gameobject?
I am trying to delay the spawning of my prefab, and I tried to do this with coroutines. In play mode, the spawning occurred first, before the Debug message was displayed to show that 2 seconds had ...
1
vote
0
answers
24
views
Coroutine not starting in Unity WebSocket client after reconnect attempt
I'm working on a Unity project using WebSocketSharp to handle network connections. My script is supposed to reconnect to the server when the connection is lost or when there's an error. I'm using a ...
1
vote
1
answer
51
views
C# Static class and methods showing strange behavior along side Unity
I have the following code in place inside of a static class, this is a static method which I call from another Monobehavior object
To give more context on the code,
I have an array of 'actions' that ...
0
votes
1
answer
81
views
Using Mathf.MoveTowards in a coroutine and the correct way to use WaitUntill
Im writing (trying) a coroutine to handle the loading of rooms in a game. Once a player enters a trigger it starts a coroutine to handle loading the different elements of the next room. Question here, ...
0
votes
1
answer
153
views
How do I setup my coroutine to go through each character's turn, one by one?
I am trying to set up a Turn-based combat system in Unity where I can step through each of the character's turns, and on the player's turn, get some input. I have heard coroutines & IEnumerators ...
0
votes
1
answer
42
views
Can't figure out how to start a saved Coroutine variable
My AI units have a few coroutines for different tasks, I wanted to be able to store the last used coroutine so that they can "pause" and "continue", but ran into a trouble that I ...
0
votes
1
answer
64
views
Coroutine causing weird spawning issue in unity
I know this is bad code (it is to be tidied up later)
I am trying to modify a tutorial by adding in a special move. Without the code for the special move the game works fine. When the enemy count is 0 ...
1
vote
1
answer
51
views
Why won't my coroutine run more than once?
In my game, the power ups that the player can pick up, first check to see if the character is already powered up. If not, then it starts the coroutine called "FireBreathing" which handles ...
0
votes
2
answers
465
views
C# using library with awaitable async methods in Unity without locking the main thread
I have a script like this:
public class Example : Monobehaviour
{
public async void Start()
{
LibraryClass service = new LibraryClass();
bool result = await service.Login();
...
0
votes
1
answer
48
views
how to start IEnumerator again after SetActive(false);
I am trying to create a picture function in my game, and I want the picture frame to vanish after a couple seconds. After I did that, when I tried to take the picture again, it wont work. I am very ...
-1
votes
1
answer
124
views
Is there a way to delay execution without a coroutine in C#? [duplicate]
I need to delay something in my script, but I cannot use a coroutine as the line I need to execute relies on reading the parameter Collider2D other from the OnTriggerEnter2D function it's written in.
...