Skip to content

could not be found #1

@Gudhein3

Description

@Gudhein3

errors:

 07:36:51   CompileMessage  [1] The type or namespace name 'PerformanceTracing' could not be found (are you missing a using directive or an assembly reference?)
 07:36:51   CompileMessage The type or namespace name 'JsonStorageProvider' could not be found (are you missing a using directive or an assembly reference?)
 07:36:51   CompileMessage The name 'Tracing' does not exist in the current context
 07:36:51   CompileMessage The name 'TracingOptions' does not exist in the current context
 07:36:51   CompileMessage The name 'TraceType' does not exist in the current context
 07:36:51   CompileMessage The name 'PerformanceTrace' does not exist in the current context
 07:36:51   CompileMessage  [1] The name 'MarkerTrace' does not exist in the current context

my code:

using PerformanceTracing;
using PerformanceTracing.Traces;
using Sandbox;
using System.Security.AccessControl;
using System.Text.Json;

public sealed class TestCube1 : Component
{
	static TestCube1()
	{
		var options = new JsonSerializerOptions
		{
			WriteIndented = true
		};
		var provider = new JsonStorageProvider( options );

		Tracing.Start( TracingOptions.Default
			.WithAppendStackTrace( true )
			.WithAppendCallerPath( true )
			.WithUseSimpleNames( false )
			.WithMaxConcurrentTraces( TraceType.Performance, 100 )
			.WithStorageProvider( provider )
		);
	}

	[Property] public Vector3 LeftTop { get; set; }
	[Property] public Vector3 RightBottom { get; set; }

	private Vector2 Pos;
	private Vector2 Vel = new Vector2( 0.7f, 1 );

	protected override void OnFixedUpdate()
	{
		using var trace = PerformanceTrace.New( "OnFixedUpdate" );

		MarkerTrace.New( "OnFixedUpdate Start" );

		Vector2 screen = new Vector2( LeftTop.y, LeftTop.z ) - new Vector2( RightBottom.y, RightBottom.z );
		if ( Pos.y > screen.y || Pos.y < 0 )
		{
			Vel.y *= -1;
		}
		if ( Pos.x > screen.x || Pos.x < 0 )
		{
			Vel.x *= -1;
		}
		Pos.x += Vel.x;
		Pos.y += Vel.y;
		Transform.Position = new Vector3( LeftTop.x, LeftTop.y + Pos.x, LeftTop.z + Pos.y );

		MarkerTrace.New( "OnFixedUpdate End" );
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions