Quantcast
Channel: Questions in topic: "loops"
Browsing all 184 articles
Browse latest View live

[C#] How do I instantiate multiple objects at the same time?

I'm instantiating two capsules with force. When I make one a prefab that has the other as a child, One of the capsules sort of shakes on the spot while the other shoots forward. I read on another...

View Article



Trying to loop through object distances?

Player starts out with some amount of fuel and life support. If they get their ship to a planet, their ship 'refuels' and they are back to full fuel and life support, otherwise these values are drained...

View Article

How do i use foreach/for loops properly?

Hello, I'm currently starting to expand my skills in the gui side of scripting, I've seen that foreach/for loops can be used to give each i in a list the same property or do something * the amount of...

View Article

Mecanim animation keeps running infinite

I made a character controller with mecanim and I have an idlestate for idling, a locostate for walking and a runningstate for running. The transition from walking to running is a boolean called...

View Article

Too many nested loops cause fatal error(?)

I have 2 nested loops, each has 9 or 10 foreach loops and if statements nested. When I try to play in editor, I get an error message that says "Fatal error! Could not allocate memory : System out of...

View Article


c# loops not working yet no erors

hi so ive just started learning c# and ime coming across a problem with loops where despite no erors coming up the loop dosent seem to be working if i put print in it dosent print anything out but if i...

View Article

DoWhile Loop is crashing Unity. Why?

The do while loop within the following script crashes Unity every time I try to run the scene. If I take the loop out of this script it runs fine, but with it in, Unity just freezes when I hit play....

View Article

How can I make a button follow the menu it's attached to?

Hello I am working on a game that has a small form factor menu that slides out when the player presses it. The menu has a set of 3 buttons that when pressed, will collapse themselves and make room for...

View Article


Yield return inside a loop slowdown problem

During Update (and using flags to call it whenever I do certain button presses) I call the FlipDiDoo coroutine to rotate a group of gameobjects. IEnumerator FlipDiDoo() { float anguloDeseado = 0.0f;...

View Article


How to make loop with call to IEnumerator actually pause?

Hello all, I am calling my function enterFlightMode which I am trying to make last ten seconds. 1 second per iteration. Heres the code. IEnumerator oneSec() { yield return new WaitForSeconds (1.0f); }...

View Article

Looping through numbered scenes

I'm new to Unity and trying to create a simple memory game where objects on unique backgrounds appear on the screen for a few seconds in a specified order. Each object is it's own scene number 1-60. I...

View Article

Step Sound Help

Hi! I have been trying to make some simple step sounds for my game. I have tried IEnumerator, loops but nothing have worked! This is a simple cut version of the script. It still contains the more...

View Article

Loop music between special times

Hi! I have a clip that I use as music and it got a great start to it. So I want the start to start playing but it never plays again. Like setting custom end times and start times for loops but still...

View Article


Argument out of range

I have a function that has the following code: int random = Random.Range( 0, playerCards.Count - 1 ); return playerCards[ random ]; The function throws an "Argument out of range exception", right...

View Article

Sequential Coroutines sometimes halt

Hello, I've been working on improving my Dissertation Project from University. This game creates a bunch of rooms, so ive been implementing Coroutines to create the map over time, rather than just in...

View Article


Collumns Match 3 remake - Help with matchmaking and neighbor gems of same type.

Hello all, I am writing a columns (SEGA) match 3 remake type game. I've adopted several methods for my design on setting up my grid (2D Array), spawning gems, moving and collision withOUT colliders....

View Article

How to create a square using Linecast & loops?

I'm trying to draw a square using loops but no success so far. This is one of my many attempts: for (int i = 0; i

View Article


for loop error

for(float z =0F; z

View Article

Can i restart my for loop from 0

Is it possible to restart my for loop under a certain condition? What im trying to accomplish is getting a tile that is not on the border of the map using a for loop but for some reason it is still...

View Article

How to start an infinite loop that cycles between two actions?

Ive been trying to program a simple infinite loop in C# that forces a game object to move up until it reaches 3f, then down until it reaches -1f, then up again. I want it to repeat infinitely until I...

View Article
Browsing all 184 articles
Browse latest View live




Latest Images