> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/scene-fusion/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/scene-fusion/api-reference/ks.scenefusion/ks.scenefusion.sfbaseobject-1.md).

# Class sfBaseObject\<T>

Namespace: [KS.SceneFusion](/scene-fusion/api-reference/ks.scenefusion.md)\
Assembly: KSUnity-Editor.dll

Base class for client and server objects. Objects of an id, type, and property. Object are synced between server and clients. Objects are arranged in a hierarchy and can be locked by users so the user with the lock can edit them.

```csharp
public abstract class sfBaseObject<T> : ksHierarchyObject<T> where T : sfBaseObject<T>
```

#### Type Parameters

`T`

#### Inheritance

object ← ksHierarchyObject\<T> ← [sfBaseObject\<T>](/scene-fusion/api-reference/ks.scenefusion/ks.scenefusion.sfbaseobject-1.md)

## Constructors

### sfBaseObject(uint, string, sfBaseProperty, ObjectFlags) <a href="#ks_scenefusion_sfbaseobject_1__ctor_system_uint32_system_string_ks_scenefusion_sfbaseproperty_ks_sce" id="ks_scenefusion_sfbaseobject_1__ctor_system_uint32_system_string_ks_scenefusion_sfbaseproperty_ks_sce"></a>

Constructor

```csharp
public sfBaseObject(uint id, string type, sfBaseProperty property, sfBaseObject<T>.ObjectFlags flags)
```

#### Parameters

`id` uint

`type` string

`property` [sfBaseProperty](/scene-fusion/api-reference/ks.scenefusion/ks.scenefusion.sfbaseproperty.md)

`flags` [sfBaseObject](/scene-fusion/api-reference/ks.scenefusion/ks.scenefusion.sfbaseobject-1.md)\<T>.[ObjectFlags](/scene-fusion/api-reference/ks.scenefusion/ks.scenefusion.sfbaseobject-1/ks.scenefusion.sfbaseobject-1.objectflags.md)

flags of object.

## Fields

### m\_directLockOwnerId <a href="#ks_scenefusion_sfbaseobject_1_m_directlockownerid" id="ks_scenefusion_sfbaseobject_1_m_directlockownerid"></a>

```csharp
protected uint m_directLockOwnerId
```

#### Field Value

uint

## Properties

### DirectLockOwnerId <a href="#ks_scenefusion_sfbaseobject_1_directlockownerid" id="ks_scenefusion_sfbaseobject_1_directlockownerid"></a>

Id of player who owns the lock on this object. 0 for no lock.

```csharp
public virtual uint DirectLockOwnerId { get; }
```

#### Property Value

uint

### Flags <a href="#ks_scenefusion_sfbaseobject_1_flags" id="ks_scenefusion_sfbaseobject_1_flags"></a>

Object flags.

```csharp
public sfBaseObject<T>.ObjectFlags Flags { get; protected set; }
```

#### Property Value

[sfBaseObject](/scene-fusion/api-reference/ks.scenefusion/ks.scenefusion.sfbaseobject-1.md)\<T>.[ObjectFlags](/scene-fusion/api-reference/ks.scenefusion/ks.scenefusion.sfbaseobject-1/ks.scenefusion.sfbaseobject-1.objectflags.md)

### Id <a href="#ks_scenefusion_sfbaseobject_1_id" id="ks_scenefusion_sfbaseobject_1_id"></a>

Object id.

```csharp
public uint Id { get; }
```

#### Property Value

uint

### Property <a href="#ks_scenefusion_sfbaseobject_1_property" id="ks_scenefusion_sfbaseobject_1_property"></a>

Object property. May be a collection of properties.

```csharp
public virtual sfBaseProperty Property { get; set; }
```

#### Property Value

[sfBaseProperty](/scene-fusion/api-reference/ks.scenefusion/ks.scenefusion.sfbaseproperty.md)

### Type <a href="#ks_scenefusion_sfbaseobject_1_type" id="ks_scenefusion_sfbaseobject_1_type"></a>

User-defined object type. Cannot be changed.

```csharp
public string Type { get; }
```

#### Property Value

string

## Methods

### FindAncestor(string, bool) <a href="#ks_scenefusion_sfbaseobject_1_findancestor_system_string_system_boolean" id="ks_scenefusion_sfbaseobject_1_findancestor_system_string_system_boolean"></a>

Finds the inner-most ancestor of the given type.

```csharp
public T FindAncestor(string type, bool includeSelf = false)
```

#### Parameters

`type` string

type to find.

`includeSelf` bool

if true, will return this object if it is the type being searched for.

#### Returns

T

inner-most ancestor of the given type, or null if none was found.

### GetLockOwnerId() <a href="#ks_scenefusion_sfbaseobject_1_getlockownerid" id="ks_scenefusion_sfbaseobject_1_getlockownerid"></a>

Gets the id of the player who owns a lock on this object, either directly or indirectly. A player is the indirect lock owner of an object if they directly lock an ancestor of that object.

```csharp
public uint GetLockOwnerId()
```

#### Returns

uint

id of player who owns the lock on this object, either directly or indirectly, or 0 if no player owns a lock on this object. This may return 0 and still be indirectly locked if one or more more players own locks on descendants of this object.

### IncrementFullLockCounts(T) <a href="#ks_scenefusion_sfbaseobject_1_incrementfulllockcounts__0" id="ks_scenefusion_sfbaseobject_1_incrementfulllockcounts__0"></a>

Adds this object's full lock count to the child and its descendants full lock counts.

```csharp
protected void IncrementFullLockCounts(T child)
```

#### Parameters

`child` T

### IncrementPartialLockCounts(T) <a href="#ks_scenefusion_sfbaseobject_1_incrementpartiallockcounts__0" id="ks_scenefusion_sfbaseobject_1_incrementpartiallockcounts__0"></a>

Increments the partial lock count on this object and its ancestors by the number of direct locks on the child and its descendants.

```csharp
protected void IncrementPartialLockCounts(T child)
```

#### Parameters

`child` T

### PerformAddChild(T) <a href="#ks_scenefusion_sfbaseobject_1_performaddchild__0" id="ks_scenefusion_sfbaseobject_1_performaddchild__0"></a>

Adds a child to the object if that does not create a circular reference. If the child has another parent, removes it from its parent first. Throws ArgumentNullException if the child is null. Updates lock counts if the child was added successfully.

```csharp
protected override bool PerformAddChild(T child)
```

#### Parameters

`child` T

child to add.

#### Returns

bool

true if the child was added. False if it could not be added, either because it was already added or adding it would create a circular reference.

### PerformInsertChild(int, T) <a href="#ks_scenefusion_sfbaseobject_1_performinsertchild_system_int32__0" id="ks_scenefusion_sfbaseobject_1_performinsertchild_system_int32__0"></a>

Inserts a child at an index if that does not create a circular reference. If the child has another parent, removes it from its parent first. Throws ArgumentNullException if the child is null. Updates lock counts if the child was inserted successfully.

```csharp
protected override bool PerformInsertChild(int index, T child)
```

#### Parameters

`index` int

index to insert at.

`child` T

child to insert.

#### Returns

bool

true if the child was inserted. False if it could not be inserted, either because it was already added, adding it would create a circular reference, or the index was out of bounds.

### PerformRemoveChild(T) <a href="#ks_scenefusion_sfbaseobject_1_performremovechild__0" id="ks_scenefusion_sfbaseobject_1_performremovechild__0"></a>

Removes a child from this object. Throws ArgumentNullException if child is null. Updates lock counts if the child was removed successfully.

```csharp
protected override bool PerformRemoveChild(T child)
```

#### Parameters

`child` T

child to remove.

#### Returns

bool

true if the child was found and removed.

### Print(bool) <a href="#ks_scenefusion_sfbaseobject_1_print_system_boolean" id="ks_scenefusion_sfbaseobject_1_print_system_boolean"></a>

Prints the object and its properties in human-readable form.

```csharp
public string Print(bool recurseChildren = false)
```

#### Parameters

`recurseChildren` bool

if true, will also print descendants of this object.

#### Returns

string

### ToString() <a href="#ks_scenefusion_sfbaseobject_1_tostring" id="ks_scenefusion_sfbaseobject_1_tostring"></a>

```csharp
public override string ToString()
```

#### Returns

string

representation of the object.
