You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone, when trying to update the materials on the brush, it gives an error, tell me where to dig, please
voidCreateCSGCube(Vector3position,floatheight){GameObjectcube=newGameObject("CSG Cube");cube.transform.position=position;varcsgBrush=cube.AddComponent<CSGBrush>();csgBrush.transform.localScale=newVector3(cubeBaseSize,height,cubeBaseSize);csgBrush.transform.SetParent(csgParent.transform);ApplyMaterials(csgBrush);}voidApplyMaterials(CSGBrushcsgBrush){if(csgBrush==null){Debug.LogError("CSGBrush for zero");return;}varsurfaces=csgBrush.Shape.TexGens;Debug.Log(surfaces);if(surfaces!=null){Debug.Log("RenderMaterial select ");for(inti=0;i<surfaces.Length;i++){surfaces[i].RenderMaterial=colorDirtMaterial;}surfaces[4].RenderMaterial=colorGrassMaterial;csgBrush.Shape.TexGens=surfaces;Debug.Log(surfaces);}else{Debug.LogWarning("RenderMaterial not select CSGBrush.");}}
My Error
NullReferenceException: Object reference not set to an instance of an object
IslandGenerator.ApplyMaterials (RealtimeCSG.Components.CSGBrush csgBrush) (at Assets/IslandGenerator.cs:75)
IslandGenerator.CreateCSGCube (UnityEngine.Vector3 position, System.Single height) (at Assets/IslandGenerator.cs:65)
IslandGenerator.GenerateMeshFromTexture () (at Assets/IslandGenerator.cs:51)
PixelMapToMeshEditor.OnInspectorGUI () (at Assets/Editor/PixelMapToMeshEditor.cs:14)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <a97926197b3e45ed8df65b2d4f0f9d77>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)```
The text was updated successfully, but these errors were encountered:
Hello everyone, when trying to update the materials on the brush, it gives an error, tell me where to dig, please
My Error
The text was updated successfully, but these errors were encountered: