> 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.client.unity.editor/ks.scenefusion.client.unity.editor.sfcomponentfinder.md).

# Class sfComponentFinder

Namespace: [KS.SceneFusion.Client.Unity.Editor](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor.md)\
Assembly: KSUnity-Source.dll

Provides a method of finding components on a game object by their type name. Each component can only be returned once. This is used to get components by name when linking components with sfObjects. Each component is returned once to prevent the component from being linked to multiple objects.

```csharp
public class sfComponentFinder
```

#### Inheritance

object ← [sfComponentFinder](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor/ks.scenefusion.client.unity.editor.sfcomponentfinder.md)

## Constructors

### sfComponentFinder(GameObject, sfComponentTranslator) <a href="#ks_scenefusion_client_unity_editor_sfcomponentfinder__ctor_unityengine_gameobject_ks_scenefusion_cli" id="ks_scenefusion_client_unity_editor_sfcomponentfinder__ctor_unityengine_gameobject_ks_scenefusion_cli"></a>

Constructor

```csharp
public sfComponentFinder(GameObject gameObject, sfComponentTranslator translator)
```

#### Parameters

`gameObject` GameObject

gameObject to get components from.

`translator` [sfComponentTranslator](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor/ks.scenefusion.client.unity.editor.sfcomponenttranslator.md)

## Properties

### InOrder <a href="#ks_scenefusion_client_unity_editor_sfcomponentfinder_inorder" id="ks_scenefusion_client_unity_editor_sfcomponentfinder_inorder"></a>

True if the components were found in the order they were requested.

```csharp
public bool InOrder { get; }
```

#### Property Value

bool

## Methods

### Find(string, long, long, out bool) <a href="#ks_scenefusion_client_unity_editor_sfcomponentfinder_find_system_string_system_int64_system_int64_sy" id="ks_scenefusion_client_unity_editor_sfcomponentfinder_find_system_string_system_int64_system_int64_sy"></a>

If fileId is non-zero, gets the component with that file id and the given type name and source file id. If none is found or fileId is zero, gets the first component with the given type name and prefab source file id that hasn't been returned yet. Each component returned is removed from the finder.

```csharp
public Component Find(string name, long sourceFileId, long fileId, out bool fileIdMismatch)
```

#### Parameters

`name` string

name of component type to find. You can get this type name from a component using sfComponentUtils.GetName.

`sourceFileId` long

sourceFileId of the component's source prefab. 0 for non-prefab component instances and transforms.

`fileId` long

fileId of the component. 0 for non-prefab asset components.

`fileIdMismatch` bool

#### Returns

Component

component that matches the type name and file ids, or null if not found.

### Find(sfObject) <a href="#ks_scenefusion_client_unity_editor_sfcomponentfinder_find_ks_scenefusion_client_sfobject" id="ks_scenefusion_client_unity_editor_sfcomponentfinder_find_ks_scenefusion_client_sfobject"></a>

Finds the component for an sfObject using it's class, prefab source file id, and file id properties. See [Find](#ks_scenefusion_client_unity_editor_sfcomponentfinder_find_system_string_system_int64_system_int64_sy).

```csharp
public Component Find(sfObject obj)
```

#### Parameters

`obj` [sfObject](/scene-fusion/api-reference/ks.scenefusion.client/ks.scenefusion.client.sfobject.md)

obj find find component for. return Component component for the sfObject, or null if none was found.

#### Returns

Component

### Find(sfObject, out bool) <a href="#ks_scenefusion_client_unity_editor_sfcomponentfinder_find_ks_scenefusion_client_sfobject_system_bool" id="ks_scenefusion_client_unity_editor_sfcomponentfinder_find_ks_scenefusion_client_sfobject_system_bool"></a>

Finds the component for an sfObject using it's class, prefab source file id, and file id properties. See [Find](#ks_scenefusion_client_unity_editor_sfcomponentfinder_find_system_string_system_int64_system_int64_sy).

```csharp
public Component Find(sfObject obj, out bool fileIdMismatch)
```

#### Parameters

`obj` [sfObject](/scene-fusion/api-reference/ks.scenefusion.client/ks.scenefusion.client.sfobject.md)

obj find find component for.

`fileIdMismatch` bool

#### Returns

Component
