C# Loops in Unity! - Beginner Scripting Tutorial

preview_player
Показать описание
This video explains how to use the For, While, and Do-While Loops. It also explains how to use the For Each loop to repeat actions in code!

Рекомендации по теме
Комментарии
Автор

Jeez.. A different teacher for each basic concept, no wonder so many are struggling to understand these "Beginner" tutorials, they are all over the place!
Unity please... if your going to do Tutorials, hire a professional tutorial creator.
The whole community could greatly benefit from a simple, practical official tutorial series for Unity.

Mossyyyyyyy
Автор

I feel like this is an excellent instructional video... If you already know the subject matter he's covering.

phillipash
Автор

We need a new version of this with the definitions for ForEach as this was *NEVER* explained.

Zyugo
Автор

Instructions unclear: my dog is speaking chinese.

gershizzle
Автор

Ooh ok. I'm a C# total noob. Great videos btws.
I just wanted to put this here for anyone like me that was like "yeah but why does this While loop code deduct a cup?!"

cupsInTheSink--;
is using a Decrement operator. -- will decrease the value by 1. ++ would do the opposite.

stefkeegan
Автор

The first time you see "while(shouldContinue == true)" is always a good time to explain why it could be instead "while(shouldContinue)".

ayukay
Автор

using UnityEngine;
using System.Collections;

public class ForeachLoop : MonoBehaviour
{
void Start ()
{
string[] strings = new string[3];

strings[0] = "First string";
strings[1] = "Second string";
strings[2] = "Third string";

foreach(string item in strings)
{
print (item);
}
}
}

for foreachloop... go to unity Learn for all the codes

adamaze
Автор

sometimes when i hear this voice i confound with dutch from rdr2

emre
Автор

Could somebody explain briefly what is "foreach loop" for. It seems like they forgot about it in the video. I would really appreciate the answer! :)

yonis
Автор

this works really well if...

you have a single shot gun script and dont want to redo it for shotguns, so you add an int for the pellets yeee

meehdrescher
Автор

probably we can all agree that we all had really bad experiences when using while loops in unity

surgicalmaterials
Автор

Also does 'I' mean iteration in the for loop? And do I have to use 'i'?

cptray-steam
Автор

Where is a good example of where I would use a do while loop? Like a gameplay mechanic? Just curious.

cptray-steam
Автор

Hi, i want a help doing a transale from a point A to point B and then to a point C. But in a loop. Please help

rep
Автор

Is there any reason not to use if Statements instead?
So instead of:
While(Bool == true)
{
DoSomething();
}

It would be:
If(Bool == true)
{
DoSomething
}else
{
DontDoSomething
}
Was just wondering because i pretty much always use if statements.

thelordofcheese
Автор

strange how i can understand these perfectly well but when actually implementing it into a game i just turn into some kind of 1 braincell organism

sakeb
Автор

it is easy to do in common terms but we need example for script

gawer
Автор

Please unity what about if I want to execute a statement after finishing the loop? 🤔

omaralkaley
Автор

IN THIS VIDEO THIS IS BILL GATES VOICE

techgamer
Автор

For being a beginner video there is so much that you pretend I know...

MishaArsellecLune