In Unity, I am getting an error for a C# that says,"(30,25); error CS1525: Invalid expression term '<=' This is my script \/

SpiderKat 1 Reputation point
2021-09-10T20:13:21.257+00:00

1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4
5 [RequireComponent(typeof(MeshFilter))]
6 public class MeshGenerator : MonoBehaviour
7 {
8 Mesh mesh;
9
10 Vector3[] vertices;
11 int[] triangles;
12
13 public int xSize = 20;
14 public int zSize = 20;
15
16 // Start is called before the first frame update
17 void Start()
18 {mesh = new Mesh();
19 GetComponent<MeshFilter>().mesh = mesh;
20
21 CreateShape();
22 UpdateMesh();
23 }
24
25 void CreateShape ()
26 {
27 vertices = new Vector3[(xSize + 1) * (zSize + 1)];
28
29 int i = 0;
30 for (int z = 0; <= zSize; z++)
31 {
32 for (int x = 0; x <= xSize; x++)
33 {
34 vertices[i] = new Vector3(x, 0, z);
35 i++;
36 }
37 }
38 }
39
40 void UpdateMesh()
41 {
41 mesh.Clear();
42
43 mesh.vertices = vertices;
44 mesh.triangles = triangles;
45
46 mesh.RecalculateNormals();
47 }
48 private void OnDrawGizmos()
49 {
50 if(vertices == null)
51 return;
52
53 for (int i = 0; i < vertices.Length; i++)
54 {
55 Gizmos.DrawSphere(vertices[i], .1f);
56 }
57 }
58 }

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,720 questions
0 comments No comments
{count} votes