codeAPI Reference

BaseCarryable.IEvent interface

calendar_today May 12, 2026 schedule ~1 min read person PatrickJr verified 50

BaseCarryable.IEvent Interface

Scene event interface for world model lifecycle events on s&box carryable items.

Methods

OnCreateWorldModel

Called when the world model is created and attached.
CSHARP
public void OnCreateWorldModel() { }

OnDestroyWorldModel

Called when the world model is destroyed.
CSHARP
public void OnDestroyWorldModel() { }

Usage

Implemented by components that need to react to world model creation/destruction on weapons and carryable items. The event is posted to the world model GameObject using ISceneEvent.PostToGameObject():

CSHARP
if ( worldModel.IsValid() )
{
    worldModel.Flags |= GameObjectFlags.NotSaved | GameObjectFlags.NotNetworked;
    WorldModel = worldModel;
    IEvent.PostToGameObject( WorldModel, x => x.OnCreateWorldModel() );
}

When destroying:

CSHARP
if ( WorldModel.IsValid() )
    IEvent.PostToGameObject( WorldModel, x => x.OnDestroyWorldModel() );

Location

File: d:\GitHubStuff\sandbox\code\Game\Weapon\BaseCarryable\BaseCarryable.WorldModel.cs

Was this helpful?