Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
metodun başına static eklersek diğer sınıflardan da çağırabiliriz.
0'dan 6'ya kadar
{
for(int i=0;i<6; i++)
{
Debug.Log(i);
if(i==6)
{ break; }
}
}
-----------------------------------------------------------------------------------------
window'dan console aç
game object ekle üzerinde add component script olarak ata
project-c# script aç
-----------------------------------------------------------------------------------------
Diziler
dizinin 0. elemanını yazan
int[] dizi = new int[100];
dizi[0] = 22;
dizi[1] = 25;
dizi[99] = 57;
Debug.Log(dizi[0]);
}
-----------------------------------------------------------------------------------------
dizinin elemanlarına değer atanmadığı için hepsini 0 yazar.
int[] dizi = new int[100];
for(int i=0;i<100;i++)
Debug.Log(dizi[i]);
-----------------------------------------------------------------------------------------
0'dan 100'e kadar yaz
void Start ()
{
int[] dizi = new int[100];
for(int i=0;i<100;i++)
{
dizi[i]=i;
Debug.Log(dizi[i]);
}
}
-----------------------------------------------------------------------------------------
ilk eleman 0 ikinci eleman 20,üçüncü eleman 30 ,diğer elemanlar(100'e kadar) 0
void Start () {
int[] dizi = new int[100];
for(int i=0;i<100;i++)
{
dizi[2] = 20;
dizi[3] = 30;
Debug.Log(dizi[i]);
}
}
-----------------------------------------------------------------------------------------
alt alta sema cem alper yazar.
string[] isimler=new string[3];
isimler[0]="sema";
isimler[1]="cem";
isimler[2]="alper";
for (int i=0;i<isimler.Length;i++)
{
Debug.Log(isimler[i]);
}
-----------------------------------------------------------------------------------------
isimleri yaşları unity'de size'den gir.girilen kişinin adını ve yaşını yazan prog
public int[] isimler;
public int[] yaslar;
void Start(){
for(int i=0;,<isimler.Length;i++)
Debug.Log("ismi="+isimler[i]+"kişisinin yaşı="+yaslar[i]);
-----------------------------------------------------------------------------------------
for ile ekrana yazı yazdırma
void Start(){
for (int i = 0; i < 10; i++)
{
Debug.Log("OYUN PROGRAMLAMA DERSİ ÇOK ZEVKLİ");
}
}
-----------------------------------------------------------------------------------------
while ile ekrana yazı yazdırma
int i = 0;
while(i<10)
{
Debug.Log("OYUN PROGRAMLAMA DERSİ ÇOK ZEVKLİ");
i++;
}
}
-----------------------------------------------------------------------------------------
for döngüsüyle oyunları ekrana yazdırma
void Start(){
string[] oyunlar = { "gta", "counter", "metin2", "raınbow", "supermarıo" };
for(int i=0;i<5;i++)
{ Debug.Log(oyunlar[i]);
} }
-----------------------------------------------------------------------------------------
while döngüsüyle oyunları ekrana yazdırma
string[] oyunlar = { "gta", "counter", "metin2", "raınbow", "supermarıo" };
int i = 0;
while (i<5)
{ Debug.Log(oyunlar[i]);
i++;
} }
-----------------------------------------------------------------------------------------
for döngüsüyle oyunları ekrana tersten yazdırma
string[] oyunlar = { "gta", "counter", "metin2", "raınbow", "supermarıo" };
for(int i=4;i>=0;i--)
{ Debug.Log(oyunlar[i]);
} }
-----------------------------------------------------------------------------------------
oyunların içinde limbo varsa bulundu yoksa bulunamadı yazan program
string[] oyunlar = { "gta", "counter", "metin2", "raınbow", "supermarıo" };
for(int i=0;i<5;i++)
{ if(oyunlar[i]=="limbo")
{Debug.Log("bulundu");}
else Debug.Log("bulunamadı");
}
}
-----------------------------------------------------------------------------------------
true false ile oyunların içinde limbo varsa bulundu yoksa bulunamadı yazan program
bool kontrol=true;
string[] oyunlar = { "gta", "counter", "metin2", "raınbow", "supermarıo" };
for(int i=0;i<5;i++)
{if(oyunlar[i]=="limbo")
{kontrol=true;
break;}
else
{kontrol=false;}
}
{if (kontrol)
{ Debug.Log("bulundu");}
else{Debug.Log("bulunamadı");}
}
-----------------------------------------------------------------------------------------
fonksiyonlar(metodlar)
ekrana sema32bilgili
void Start(){
toplama("sema", 32, "bilgili");
}
// Update is called once per frame
void Update()
{
}
void toplama(string x, int y, string z)
{ Debug.Log(x + y + z); }
}
-----------------------------------------------------------------------------------------
0'dan 14'e kadar metodla yazma
void Start()
{
sayici(15);
}
// Update is called once per frame
void Update () {
}
void sayici(int x)
{
for (int i = 0; i < x; i++)
Debug.Log(i);
}
}
-----------------------------------------------------------------------------------------
metodla sayıları toplayan
{
int sayi = toplama(25, 35);
Debug.Log(sayi);
}
// Update is called once per frame
void Update () {
}
int toplama(int x, int y)
{ return x + y; }
}
-----------------------------------------------------------------------------------------
string ile sayıların toplamı
void Start()
{
string metin = deneme(300, 500);
Debug.Log(metin);
}
// Update is called once per frame
void Update () {
}
string deneme(int x, int y)
{ return "bu sayıların toplamı="+(x + y); }
}
-----------------------------------------------------------------------------------------
-10
void Start()
{
matematik x = new matematik();
Debug.Log(x.cikarma(20, 30));
}
void Update ()
{
}
}
class matematik
{
public int cikarma(int a, int b)
{ return a - b; }
public int carpma(int a, int b)
{ return a * b; }
}
-----------------------------------------------------------------------------------------
class'ta static kullanarak matematiksel işlem yapma
void Start()
{
Debug.Log(matematik.cikarma(60, 30));
}
void Update () {
}
}
class matematik
{
public static int cikarma(int a, int b)
{ return a - b; }
public static int carpma(int a, int b)
{ return a * b; }
}
-----------------------------------------------------------------------------------------
obje oluşturma
void Start()
{
for(int i=0;i<=5;i++)
{GameObject obje=new GameObject();}
}
void Update()
{
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team