Unityをやっている初心者です。必要な情報がすべて載っていなかったらすいません。
C#でフィールドを作りそこでunityちゃんを歩かせようとしているのですが下の写真のように浮かんでしまいます。
unityちゃんの大きさを小さくすると治るのですが理由がわからないです。
浮かんでいる原因を教えて欲しいです。
以下、フィールドを作る際に使用したスクリプトです
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class createfield : MonoBehaviour 6{ 7 private int i = 0, u = 0; 8 GameObject[,] field = new GameObject[10, 10]; 9 GameObject[,] syoutotu = new GameObject[10, 10]; 10 // Use this for initialization 11 void Start() 12 { 13 for (i = 0; i <= 4; i++) 14 { 15 var pos = new Vector3(10 * (i), 0, 0); 16 var rot = new Vector3(0, 0, 0); 17 GameObject fieldobj = (GameObject)Resources.Load("Plane"); 18 GameObject syoutotuobj = (GameObject)Resources.Load("masshantei"); 19 GameObject mass = Object.Instantiate(fieldobj, pos, Quaternion.Euler(rot)); 20 GameObject massme = Object.Instantiate(syoutotuobj, pos, Quaternion.Euler(rot)); 21 field[0, i] = mass; 22 syoutotu[0, i] = massme; 23 for (u = 0; u <= 4; u++) 24 { 25 var pos1 = new Vector3(10 * (i), 0, 10 * (u + 1)); 26 27 GameObject fieldobj1 = (GameObject)Resources.Load("Plane"); 28 GameObject syoutotuobj1 = (GameObject)Resources.Load("masshantei"); 29 GameObject massme1 = Object.Instantiate(syoutotuobj1, pos1, Quaternion.Euler(rot)); 30 GameObject mass1 = Object.Instantiate(fieldobj1, pos1, Quaternion.Euler(rot)); 31 field[u, i] = mass1; 32 syoutotu[u,i] = massme1; 33 } 34 35 // Update is called once per frame 36 37 } 38 39 } 40}
回答1件
あなたの回答
tips
プレビュー