I can't seem to paint my terrain

Hello there,

I decided to retexture my terrain in order to prep it for Unity’s Timeline and for my level beat design. However, when I opened up the painting setting for my terrain, Unity wasn’t in a good mood and decided not to let me paint my terrain.

14%20PM
How would I fix this issue? I’d appreciate your help.
Thanks.

Hi,

Which version of Unity do you use?

I’m using 2019.2.2f1. There is also a terrain in the scene window, as you asked on Udemy.

Here is a full screen image:

Did you update Unity at some point? Or did this suddenly happen?

To what is the error message in your console referring?

I haven’t updated Unity. It suddenly happened.

Here is the console:

NullReferenceException means that a reference (“link”) to an instance is missing. The error messages seem to refer to your Terrain.

image

If that does not help, delete the Terrain game object (not your terrain data in your Assets folder!). Create a new game object, assign a Terrain and a TerrainCollider component to it. Then assign your Terrain from your Assets folder to the exposed field in the Terrain component. That should hopefully work.

Both methods did not seem to work for me.

I’ve recorded 2 videos, showing what I did in both methods:

Edit: I’ve started adding a timeline and I’m getting a similar error for the animator:


Also, the timeline area doesn’t state it is recording when I click the red dot to record. However, it does take in values only when I click ‘Add Key’ at the transform component, meaning the timeline works when I play the game.

Edit 2: Timeline seems to be working normally now after doing something with the layout of windows. Don’t know if this is a one time thing though.

Deleting the Terrain game object didn’t work either? If not, try to update Unity to the latest stable version. Maybe you have a bug in your version. There have been a couple of updates in the last few days.

Deleting the terrain game object didn’t work either, as I’ve shown above in method 2. I’ve tried opening my project in the latest version of Unity and that didn’t also work.

I’ve read about the Null Reference error some days back and it refers to the face that a variable has been declared and then is being used without that variable being initialised. So the something in the terrain game object is declared without initialisation and then is being used.

If you can’t really come up with a solution, it’s fine. I’ll just leave the terrain as is. Its texturing is mainly complete anyways. Just wanted to change some bits and fine tune it.

I appreciate your help. :slightly_smiling_face:

Could you upload your project to GitHub and share a link here? I’d like to take a look into it. Do not upload the Temp and the Library folder. Maybe I can find a fix. :confused:

I was having trouble with GitHub, since I was using it for the first time, and was having trouble uploading my project. Could you me please help on how to upload a project to GitHub.

Create a new repository on GitHub. Then upload your files.

Here is the link to the GitHub page of my project. You will have to contract the project folder though, due to the way I did it. The places where you should place each file is written in the commit messages. And ALL files should be placed within the main project folder. The assets I have linked to Google Drive, which you have to download (it is 5.66 GB though :grimacing:).

Hope I haven’t troubled you too much.

5.66 gb is extremely huuuuge. I hope I’m able to download your project with a reasonable amount of time.

The structure on GutHub should have looked like this: https://github.com/CompleteUnityDeveloper2/3_Project_Boost

It’s okay for now, though. I’m trying to get your project from Google Drive.

I’m afraid it is not possible for me to open your project. You have to share the entire project folder excluding the Temp and the Library folder. For instance, the World scene, your Terrain and a bunch of other prefabs are missing.

image

So, because I tried to properly get my repo onto GitHub, I decided to delete my SourceTree repo and start again. However, deleting entire repo also deleted my game. Aaaand for some reason I immediately emptied trash after.

Luckily, I had made a zip file of my project. So I unzipped the file and reopened my project and for some out of this world reason, I can now paint my terrain :exploding_head:. I have no idea why.

Here is a screenshot showing it. Notice that I have a new error too, which is referring to a texture. Don’t know if it is related in anyway to me not being able to paint.

Well, at least I can paint now. Do you have any theories why Unity is allowing me to paint now? Maybe it is in a better mood…

Check all your Textures in the Terrain Layers. Maybe one of the is missing. In that case, you either have to delete it if you cannot find the texture, or to reassign it if the texture is in your Assets folder.

This topic was automatically closed after 14 days. New replies are no longer allowed.

Privacy & Terms