WM/WatermelonCollect6.cs

A component that listens for trigger enters to collect a specific watermelon. On trigger it increments a global ScoreManager counter, sets a collected flag, plays a sound, and then destroys its GameObject on the next update if the flag is set.

File Access
using Sandbox; 

public sealed class WatermelonCollect6 : Component, Component.ITriggerListener
{
	[Property] public SoundEvent melon { get; set; }
	void ITriggerListener.OnTriggerEnter( Collider collision )
	{

		ScoreManager.WMCount += 1;
		ScoreManager.WM6collect = true;
		GameObject.PlaySound( melon );

	}
	protected override void OnUpdate()
	{
		
		if ( ScoreManager.WM6collect)
		{
			GameObject.Destroy();
			
		}
	}
	
}