Get thousand of error when i draw a disc
Hi Freya, i am get this bug each frame:
2024/11/06 00:14:20.686 25282 25338 Error Unity NullReferenceException: Object reference not set to an instance of an object.
2024/11/06 00:14:20.686 25282 25338 Error Unity at Shapes.IMDrawer..ctor (Shapes.MetaMpb metaMpb, UnityEngine.Material sourceMat, UnityEngine.Mesh sourceMesh, System.Int32 submesh, Shapes.IMDrawer+DrawType drawType, System.Boolean allowInstancing, System.Int32 textAutoDisposeId) [0x00000] in <00000000000000000000000000000000>:0
2024/11/06 00:14:20.686 25282 25338 Error Unity at Shapes.Draw.DiscCore (System.Boolean hollow, System.Boolean sector, System.Single radius, System.Single thickness, Shapes.DiscColors colors, System.Single angleRadStart, System.Single angleRadEnd, Shapes.ArcEndCap arcEndCaps) [0x00000] in <00000000000000000000000000000000>:0
2024/11/06 00:14:20.686 25282 25338 Error Unity at UnitsRTS.UI.ButtonSelectUnitsToActionUI..ctor () [0x00000] in <00000000000000000000000000000000>:0
2024/11/06 00:14:20.686 25282 25338 Error Unity at UnitsRTS.DrawAllUnitSelectedStatus.DrawShapes (UnityEngine.Camera cam) [0x00000] in <00000000000000000000000000000000>:0
2024/11/06 00:14:20.686 25282 25338 Error Unity at UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderCameraStack (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine
2024/11/06 00:14:20.694 25282 25338 Warn Unity Render Pipeline error : the XR layout still contains active passes. Executing XRSystem.EndLayout() right now.
2024/11/06 00:14:20.694 25282 25338 Warn Unity UnityEngine.Experimental.Rendering.XRSystem:NewLayout()
2024/11/06 00:14:20.694 25282 25338 Warn Unity UnityEngine.Rendering.Universal.UniversalRenderPipeline:RenderCameraStack(ScriptableRenderContext, Camera)
2024/11/06 00:14:20.694 25282 25338 Warn Unity UnityEngine.Rendering.Universal.UniversalRenderPipeline:Render(ScriptableRenderContext, List`1)
2024/11/06 00:14:20.694 25282 25338 Warn Unity UnityEngine.Rendering.RenderPipelineManager:DoRenderLoop_Internal(RenderPipelineAsset, IntPtr, Object)
2024/11/06 00:14:20.694 25282 25338 Warn Unity
my code is:
public class DrawAllUnitSelectedStatus : ImmediateModeShapeDrawer
{
[SerializeField]
private float animationOffsetSpeed = 1;
private float offsetAnimation;
private Color colorAttackStatus;
private bool colorAttactStatusAsigned;
private static readonly Color colorSelectedStatus = new Color(1, 1, 1, 1);
public override void DrawShapes(Camera cam)
{
if(!colorAttactStatusAsigned)
{
if(TeamColor.Instance.GetIfSetupColorPlayer(DictionaryConnectionPlayers.Instance.LocalPlayerIdLogin))
{
colorAttackStatus = TeamColor.Instance.GetTeamColorOfPlayerIdLogin(DictionaryConnectionPlayers.Instance.LocalPlayerIdLogin);
colorAttactStatusAsigned = true;
}
else
return;
}
offsetAnimation += animationOffsetSpeed * Time.deltaTime;
offsetAnimation %= 1f;
using(Draw.Command(cam))
{
Draw.ZTest = CompareFunction.LessEqual;
Draw.LineGeometry = LineGeometry.Flat2D;
Draw.ThicknessSpace = ThicknessSpace.Meters;
Draw.Matrix = Matrix4x4.TRS(Vector3.up * 0.1f, Quaternion.LookRotation(Vector3.down), Vector3.one);
Draw.Color = colorAttackStatus;
for(int i = 0; i < UnitSelectedVisual.listUnitAttackStatusPosition.Count; i++)
Draw.Ring(UnitSelectedVisual.listUnitAttackStatusPosition[i], UnitSelectedVisual.listUnitAttackStatusScale[i] + 0.15f, thickness: 0.075f);
Draw.Color = colorSelectedStatus;
for(int i = 0; i < UnitSelectedVisual.listUnitSelectedStatusPosition.Count; i++)
Draw.Ring(UnitSelectedVisual.listUnitSelectedStatusPosition[i], UnitSelectedVisual.listUnitSelectedStatusScale[i], thickness: 0.05f);
Draw.Thickness = 0.075f;
Draw.UseDashes = true;
Draw.DashStyle = DashStyle.MeterDashes(DashType.Rounded, 0.25f, 0.15f, DashSnapping.EndToEnd, offsetAnimation);
for(int i = 0; i < UnitSelectedVisual.listUnitSelectedToActionStatusPosition.Count; i++)
Draw.Ring(UnitSelectedVisual.listUnitSelectedToActionStatusPosition[i], UnitSelectedVisual.listUnitSelectedToActionStatusScale[i], thickness: 0.075f);
}
UnitSelectedVisual.listUnitSelectedStatusPosition.Clear();
UnitSelectedVisual.listUnitSelectedToActionStatusPosition.Clear();
UnitSelectedVisual.listUnitAttackStatusPosition.Clear();
UnitSelectedVisual.listUnitSelectedStatusScale.Clear();
UnitSelectedVisual.listUnitSelectedToActionStatusScale.Clear();
UnitSelectedVisual.listUnitAttackStatusScale.Clear();
}
}
In the previous version (4.3.1) all works right