Error CS0103

Hi folks,

I’m currently making a game named “Planetsave” in Unity3D to tell the players that they should save our planet. The game shouldn’t contain environmentally harmful things and planet harmful things. But in one of the scripts, there’s the very shitty unity error CS0103 and I can’t remove this error. It says: “The Name ‘noiseMap’ doesn’t exist in the current content”, but it does exist in the current content! Now I need very urgently help with fixing this very shitty scripting error! Can you please help me? Here’s the C#-source code from the faulty script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TileGeneration : MonoBehaviour {
  [SerializeField]
  NoiseMapGeneration noiseMapGeneration;
  [SerializeField]
  private MeshRenderer tileRenderer;
  [SerializeField]
  private MeshFilter meshFilter;
  [SerializeField]
  private MeshCollider meshCollider;
  [SerializeField]
  private float mapScale;
  void Start() {
    GenerateTile ();
  }
  void GenerateTile() {
                // calculate tile depth and width based on the mesh vertices
    Vector3[] meshVertices = this.meshFilter.mesh.vertices;
    int tileDepth = (int)Mathf.Sqrt (meshVertices.Length);
    int tileWidth = tileDepth;
                // calculate the offsets based on the tile position
    float[,] heightMap = this.noiseMapGeneration.GenerateNoiseMap (tileDepth, tileWidth, this.mapScale);
                // generate a heightMap using noise
    Texture2D tileTexture = BuildTexture (heightMap);
    this.tileRenderer.material.mainTexture = tileTexture;
  }
  private Texture2D BuildTexture(float[,] heightMap) {
    int tileDepth = noiseMap.GetLength (0);
    int tileWidth = noiseMap.GetLength (1);
    Color[] colorMap = new Color[tileDepth * tileWidth];
    for (int zIndex = 0; zIndex < tileDepth; zIndex++) {
      for (int xIndex = 0; xIndex < tileWidth; xIndex++) {
                                // transform the 2D map index is an Array index
        int colorIndex = zIndex * tileWidth+ xIndex;
        float height= heightMap[zIndex, xIndex];
                                // assign as color a shade of grey proportional to the height value
        colorMap [colorIndex] = Color.Lerp (Color.black, Color.white, height);
      }
    }
                // create a new texture and set its pixel colors
    Texture2D tileTexture = new Texture2D (tileWidth, tileDepth);
    tileTexture.wrapMode = TextureWrapMode.Clamp;
    tileTexture.SetPixels (colorMap);
    tileTexture.Apply ();
    return tileTexture;
  }
}

And please also note that I’m very new to unity and I only can a bit C#. If you can help me with fixing this very shitty error, it’d be very helpful!

I’ve currently a visitor at home and I’m currently also learning C# from him.

Here I’ve found a resolution, but this shitty resolution doesn’t help me…

Sincerely yours,
Atten007

I’ve fixed this very shitty error, I don’t need help anymore…

It’s not a Unity error, it’s a C# compiler error and I’m not sure what the language is all about. You also get told which line and column the error is on but you didn’t post the full error so we have to guess.

A quick glance at the code and I see “noiseMap” on lines 31/32 (is the error reported there?) but that doesn’t exist. I mean, can YOU see it anywhere? So as a complete guess I’d say you meant “heightMap” which is right before it. All this without it being “S***ty”. :wink:

The compiler is saying “I have no idea what the thing is you’re referring to”.

You need to very urgently learn how to fix your typographic errors. It’s not hard. Here’s how:

Remember: NOBODY here memorizes error codes. That’s not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.

The complete error message contains everything you need to know to fix the error yourself.

Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors.

The important parts of the error message are:

  • the description of the error itself (google this; you are NEVER the first one!)
  • the file it occurred in (critical!)
  • the line number and character position (the two numbers in parentheses)
  • also possibly useful is the stack trace (all the lines of text in the lower console window)

All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don’t have to stop your progress and fiddle around with the forum.