There is a serious problem with C# resource

So i decided to create my first resource in C# since i have some knowledge with it and i got surprised that it uses 0.13ms in resmon

using CitizenFX.Core;
using CitizenFX.Core.Native;
using System.Threading.Tasks;

namespace Assets
{
    public class Assets : BaseScript
    {
        public Assets()
        {
            Tick += OnTick;
        }

        private async Task OnTick()
        {
            // Reduce Traffic
            API.SetVehicleDensityMultiplierThisFrame(0.1f);
            API.SetRandomVehicleDensityMultiplierThisFrame(0.1f);
            API.SetScenarioPedDensityMultiplierThisFrame(0.0f, 0.0f);

            API.SetGarbageTrucks(false);
            API.SetRandomBoats(false);

            API.SetCreateRandomCops(false);
            API.SetCreateRandomCopsNotOnScenarios(false);
            API.SetCreateRandomCopsOnScenarios(false);

            await Task.FromResult(0);
        }
    }
}

Wow, 130 microseconds! That’s quite little! How is this ‘a serious problem’?

When this code was in LUA, it was run at 0.01ms :slight_smile: u still dont get it ??

It’s completely normal considering your client has to switch contexts and the normal overhead of AppDomain.

There’s a typical overhead that wont increase the more code you run so don’t worry about it.

U still don’t get it? :blush:

oh okay, so this “fake” high ms will not affect my FPS ?