SebLague / Procedural-Landmass-Generation

Procedural Landmass Generation in Unity
https://www.youtube.com/playlist?list=PLFt_AvWsXl0eBW2EiBtl_sxmDtSgZBxB3
MIT License
1.11k stars 595 forks source link

NullReferenceException #28

Open danksup opened 4 years ago

danksup commented 4 years ago

Hi, im currently at the last episode, and i got this error everytime im messing around with texture layers. any solution? This is the error that i got:

NullReferenceException UnityEngine.Texture.get_width () (at :0) UnityEngine.Texture2D.GetPixels (System.Int32 miplevel) (at :0) UnityEngine.Texture2D.GetPixels () (at :0) TextureData.GenerateTextureArray (UnityEngine.Texture2D[] textures) (at Assets/script/Procedural Landmass Generation/Data/TextureData.cs:46) TextureData.ApplyToMaterial (UnityEngine.Material material) (at Assets/script/Procedural Landmass Generation/Data/TextureData.cs:26) MapPreview.OnTextureValuesUpdated () (at Assets/script/Procedural Landmass Generation/MapPreview.cs:83) UpdatableData.NotifyOfUpdatedValues () (at Assets/script/Procedural Landmass Generation/Data/UpdatableData.cs:21) UpdatableDataEditor.OnInspectorGUI () (at Assets/script/Procedural Landmass Generation/Editor/UpdatableDataEditor.cs:17) UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.b__0 () (at <67055f1be3654e2a987254d5437ee5b8>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

OfficialSammyTheWolf commented 3 years ago

hello, i have the same issue, i tried everything and i would like any help, so if you have discord could you DM me when you will find the solution please ? because i'm not 24/7 on GitHub and i would probably found the solution after i fixed it myself. Thanks (If you don't have discord here is my twitter https://twitter.com/SammytheWolf5)

OfficialSammyTheWolf commented 3 years ago

ok, i found what was wrong with my error, i removed the texture fro mthe texture slot so it didn't had texture and that's why the error was there, try adding the texture to the texture slot and then update