Tofu/TofuCollect5.cs

A scene/component script that listens for trigger enter events. On trigger it increments a global ScoreManager.TofuCount, sets ScoreManager.Tofu5collect true, plays a SoundEvent, and then destroys the GameObject on the next update if the flag is set.

Native Interop
using Sandbox;

public sealed class TofuCollect5 : Component, Component.ITriggerListener
{
	[Property] public SoundEvent tofu { get; set; }
	void ITriggerListener.OnTriggerEnter( Collider collision )
	{
		ScoreManager.TofuCount += 1;
		ScoreManager.Tofu5collect = true;
		GameObject.PlaySound( tofu );
	}
	protected override void OnUpdate()
	{

		if ( ScoreManager.Tofu5collect )
		{
			GameObject.Destroy();

		}
	}
}