diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b5e08638..122b20fd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Fixed + +- [PBLD-279] Fixed an issue where serialization warning would appear upon creating a probuilder shape. + ## [6.0.8] - 2025-11-17 ### Fixed diff --git a/Runtime/Shapes/Arch.cs b/Runtime/Shapes/Arch.cs index fb93b6bf3..2f181a491 100644 --- a/Runtime/Shapes/Arch.cs +++ b/Runtime/Shapes/Arch.cs @@ -7,6 +7,7 @@ namespace UnityEngine.ProBuilder.Shapes /// Represents a basic [arch](../manual/Arch.html) shape. /// [Shape("Arch")] + [System.Serializable] public class Arch : Shape { /// diff --git a/Runtime/Shapes/Cone.cs b/Runtime/Shapes/Cone.cs index 7093ef79a..34bf1857f 100644 --- a/Runtime/Shapes/Cone.cs +++ b/Runtime/Shapes/Cone.cs @@ -7,6 +7,7 @@ namespace UnityEngine.ProBuilder.Shapes /// Represents a basic [cone](../manual/Cone.html) shape. /// [Shape("Cone")] + [System.Serializable] public class Cone : Shape { /// @@ -25,7 +26,7 @@ public class Cone : Shape /// [SerializeField] bool m_Smooth = true; - + internal override void SetParametersToBuiltInShape() { m_NumberOfSides = 8; diff --git a/Runtime/Shapes/Cube.cs b/Runtime/Shapes/Cube.cs index 14874c236..47d61c716 100644 --- a/Runtime/Shapes/Cube.cs +++ b/Runtime/Shapes/Cube.cs @@ -6,6 +6,7 @@ namespace UnityEngine.ProBuilder.Shapes /// Represents a basic [cube](../manual/Cube.html) shape. /// [Shape("Cube")] + [System.Serializable] public class Cube : Shape { /// @@ -25,14 +26,14 @@ public class Cube : Shape new Vector3(.5f, .5f, -.5f), // 6 new Vector3(-.5f, .5f, -.5f) // 7 }; - + /// /// Defines a set of triangles forming a cube with reference to the k_CubeVertices array. /// static readonly int[] k_CubeTriangles = new int[] { 0, 1, 4, 5, 1, 2, 5, 6, 2, 3, 6, 7, 3, 0, 7, 4, 4, 5, 7, 6, 3, 2, 0, 1 }; - + internal override void SetParametersToBuiltInShape() { } /// @@ -47,14 +48,14 @@ public override Bounds RebuildMesh(ProBuilderMesh mesh, Vector3 size, Quaternion for (int i = 0; i < k_CubeTriangles.Length; i++) points[i] = rotation * Vector3.Scale(k_CubeVertices[k_CubeTriangles[i]], Math.Abs(size)); - + mesh.GeometryWithPoints(points); - + UvUnwrapping.SetAutoUV(mesh, mesh.facesInternal, true); foreach (var face in mesh.facesInternal) face.uv = new AutoUnwrapSettings(face.uv) { anchor = AutoUnwrapSettings.Anchor.UpperLeft}; mesh.RefreshUV(mesh.faces); - + return mesh.mesh.bounds; } } diff --git a/Runtime/Shapes/Cylinder.cs b/Runtime/Shapes/Cylinder.cs index 57f2f6404..8c1acf197 100644 --- a/Runtime/Shapes/Cylinder.cs +++ b/Runtime/Shapes/Cylinder.cs @@ -6,6 +6,7 @@ namespace UnityEngine.ProBuilder.Shapes /// Represents a basic [cylinder](../manual/Cylinder.html) shape. /// [Shape("Cylinder")] + [System.Serializable] public class Cylinder : Shape { /// @@ -30,7 +31,7 @@ public class Cylinder : Shape /// [SerializeField] bool m_Smooth = true; - + internal override void SetParametersToBuiltInShape() { m_AxisDivisions = 8; diff --git a/Runtime/Shapes/Door.cs b/Runtime/Shapes/Door.cs index 32f396014..78bdaa6be 100644 --- a/Runtime/Shapes/Door.cs +++ b/Runtime/Shapes/Door.cs @@ -7,6 +7,7 @@ namespace UnityEngine.ProBuilder.Shapes /// Represents a basic [door](../manual/Door.html) shape. /// [Shape("Door")] + [System.Serializable] public class Door : Shape { /// @@ -30,7 +31,7 @@ internal override void SetParametersToBuiltInShape() m_DoorHeight = 0.5f; m_LegWidth = 0.75f; } - + /// public override void CopyShape(Shape shape) { diff --git a/Runtime/Shapes/Pipe.cs b/Runtime/Shapes/Pipe.cs index 69c39a91b..bed4a5a5b 100644 --- a/Runtime/Shapes/Pipe.cs +++ b/Runtime/Shapes/Pipe.cs @@ -7,6 +7,7 @@ namespace UnityEngine.ProBuilder.Shapes /// Represents a basic [pipe](../manual/Pipe.html) shape. /// [Shape("Pipe")] + [System.Serializable] public class Pipe : Shape { /// @@ -39,7 +40,7 @@ public class Pipe : Shape /// [SerializeField] bool m_Smooth = true; - + internal override void SetParametersToBuiltInShape() { m_Thickness = 0.25f; diff --git a/Runtime/Shapes/Plane.cs b/Runtime/Shapes/Plane.cs index 6c3eb2470..0d5a9919c 100644 --- a/Runtime/Shapes/Plane.cs +++ b/Runtime/Shapes/Plane.cs @@ -6,6 +6,7 @@ namespace UnityEngine.ProBuilder.Shapes /// Represents a basic [plane](../manual/Plane.html) shape. /// [Shape("Plane")] + [System.Serializable] public class Plane : Shape { /// diff --git a/Runtime/Shapes/Prism.cs b/Runtime/Shapes/Prism.cs index 45986a756..f8441e66c 100644 --- a/Runtime/Shapes/Prism.cs +++ b/Runtime/Shapes/Prism.cs @@ -6,10 +6,11 @@ namespace UnityEngine.ProBuilder.Shapes /// Represents a basic [prism](../manual/Prism.html) shape. /// [Shape("Prism")] + [System.Serializable] public class Prism : Shape { internal override void SetParametersToBuiltInShape() { } - + /// public override void CopyShape(Shape shape) {} diff --git a/Runtime/Shapes/Sphere.cs b/Runtime/Shapes/Sphere.cs index d564e6066..f1ae8db15 100644 --- a/Runtime/Shapes/Sphere.cs +++ b/Runtime/Shapes/Sphere.cs @@ -6,6 +6,7 @@ namespace UnityEngine.ProBuilder.Shapes /// Represents a basic [sphere](../manual/Sphere.html) shape. /// [Shape("Sphere")] + [System.Serializable] public class Sphere : Shape { static readonly Vector3[] k_IcosphereVertices = new Vector3[12] @@ -67,7 +68,7 @@ public class Sphere : Shape int m_BottomMostVertexIndex = 0; /// - /// Determines whether to smooth the edges of the polygons. + /// Determines whether to smooth the edges of the polygons. /// This property is enabled by default. /// [SerializeField] @@ -78,7 +79,7 @@ internal override void SetParametersToBuiltInShape() m_Subdivisions = 2; m_Smooth = false; } - + /// public override void CopyShape(Shape shape) { diff --git a/Runtime/Shapes/Sprite.cs b/Runtime/Shapes/Sprite.cs index 4bdb31627..d58fe14bb 100644 --- a/Runtime/Shapes/Sprite.cs +++ b/Runtime/Shapes/Sprite.cs @@ -6,10 +6,11 @@ namespace UnityEngine.ProBuilder.Shapes /// Represents a basic [sprite](../manual/Sprite.html) (a single-unit plane shape). /// [Shape("Sprite")] + [System.Serializable] public class Sprite : Shape { internal override void SetParametersToBuiltInShape() { } - + /// public override void CopyShape(Shape shape) {} diff --git a/Runtime/Shapes/Stairs.cs b/Runtime/Shapes/Stairs.cs index ed027873d..67fc8afe3 100644 --- a/Runtime/Shapes/Stairs.cs +++ b/Runtime/Shapes/Stairs.cs @@ -23,6 +23,7 @@ enum StepGenerationType /// Represents a basic [stairs](../manual/Stairs.html) shape. /// [Shape("Stairs")] + [System.Serializable] public class Stairs : Shape { /// @@ -51,12 +52,12 @@ public class Stairs : Shape [Range(1, 256)] [SerializeField] int m_StepsCount = 10; - internal int stepsCount + internal int stepsCount { get => m_StepsCount; set => m_StepsCount = value; } - + /// /// Determines whether to force every step to be the exactly the same height. If disabled, /// the height of the last step is smaller than the others depending on the remaining height. @@ -78,7 +79,7 @@ internal int stepsCount [SerializeField] float m_Circumference = 0f; - internal float circumference + internal float circumference { get => m_Circumference; set => m_Circumference = value; @@ -103,7 +104,7 @@ public bool sides [SerializeField, Min(0f)] float m_InnerRadius; - internal float innerRadius + internal float innerRadius { get => m_InnerRadius; set => m_InnerRadius = value; diff --git a/Runtime/Shapes/Torus.cs b/Runtime/Shapes/Torus.cs index b885c233e..74f29a44e 100644 --- a/Runtime/Shapes/Torus.cs +++ b/Runtime/Shapes/Torus.cs @@ -8,6 +8,7 @@ namespace UnityEngine.ProBuilder.Shapes /// Represents a basic [torus](../manual/Torus.html) shape. /// [Shape("Torus")] + [System.Serializable] public class Torus : Shape { ///