【ゲームエンジン】Unityなんでも質問スレpart9at GAMEDEV
【ゲームエンジン】Unityなんでも質問スレpart9 - 暇つぶし2ch364:名前は開発中のものです。
23/01/18 01:17:56.54 gb9xw2nh.net
回答ありがとうございます。
>>357自分がやりたいのはこれです。
for文を使ってやってみたのですがaの値が同じになってしまいます。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class practice : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
int a = Random.Range(1, 11);
int b = 0;
for (int i = 0; i < 3; i ++)
{
b += a;
}
Debug.Log(a);
Debug.Log(b);
}

}
これだとコンソールに3,9や5,15, 10,30と表示されます。
b = a + a + aも駄目でした。


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch