Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

I keep on having a error on script. I tried everything and nothing seems to be working.

$
0
0
I keep on having the error code "CS1955" it's "Assets/Chunk.cs(73,24): error CS1955: The member `Chunk.map' cannot be used as method or delegate". here's my script it's not done but if you could find out what's going on I hope you could help me. thanks using UnityEngine; using System.Collections; using System.Collections.Generic; [RequireComponent (typeof(MeshFilter))] public class Chunk : MonoBehaviour { public int width = 20; public byte[,,] map; protected Mesh mesh; protected List verts = new List(); protected List tris = new List(); protected List uv = new List(); // Use this for initialization void Start () { map = new byte[width, width, width]; for (int x = 0; x < width; x++) { for (int z = 0; z < width; z++) { map[x, 0, z] = 1; map[x, 1, z] = (byte)Mathf.RoundToInt(Random.value); } } mesh = new Mesh(); GetComponent().mesh = mesh; Regenerate(); } // Update is called once per frame void Update () { } public void DrawBrick(int x, int y, int z, byte block) { Vector3 start = new Vector3(x, y, z); Vector3 offset1, offset2; if (IsTransparent(x, y - 1, z)) { offset1 = Vector3.right; offset2 = Vector3.back; DrawFace(start, offset1, offset2, block); } } public void DrawFace (Vector3 start, Vector3 offset1, Vector3 offset2, byte block) { int index = verts.Count; verts.Add (start); verts.Add (start + offset1); verts.Add (start + offset2); verts.Add (start + offset1 + offset2); tris.Add (index + 0); tris.Add (index + 1); tris.Add (index + 2); tris.Add (index + 3); tris.Add (index + 2); tris.Add (index + 1); } public bool IsTransparent(int x, int y, int z) { if ((x< 0) || (y < 0) || (z < 0) || (x >= width) || (y >= width) || (z >= width)) return true; return map(x,y,z) +=0; } public void Regenerate() { verts.Clear (); tris.Clear(); uv.Clear(); mesh.triangles = tris.ToArray(); for (int x = 0; x < width; x++) { for (int y = 0; y < width; y++) { for (int z = 0; z < width; z++) { byte block = map[x,y,z]; if (block == 0) continue; DrawBrick(x, y, z, block); } } } mesh.vertices = verts.ToArray(); mesh.triangles = tris.ToArray(); mesh.RecalculateNormals(); } }

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>