# Area of Interest (Observer System)

An **observer** is a client which can see an object and use communications for the object. You may control which clients can observe an object by using the [NetworkObserver](https://fish-networking.gitbook.io/docs/fishnet-building-blocks/components/network-observer) and/or [ObserverManager](https://fish-networking.gitbook.io/docs/fishnet-building-blocks/components/managers/observermanager) components.

If a client is not an observer of an object, then the object will not activate, and the client will not receive network messages or callbacks for that object. Should the object be a [scene object](https://fish-networking.gitbook.io/docs/high-level-overview/terminology/miscellaneous#scene-object) then it will remain disabled on the client until they become an observer of it. If the object is [instantiated](https://fish-networking.gitbook.io/docs/high-level-overview/terminology/miscellaneous#instantiated-object), then the client will simply not instantiate the object until after becoming an observer.

The observer system is designed to work out of the box for new developers. When it comes time to customize how clients observe objects, the observer system additionally offers a large amount of flexibility, keeping in mind there are many condition types, and that you may also create your own.

FishNet comes with a NetworkManager prefab which contains the recommended minimum components to begin working on a new project. Within that prefab is the [ObserverManager](https://fish-networking.gitbook.io/docs/fishnet-building-blocks/components/managers/observermanager) with an included [Scene Condition](https://fish-networking.gitbook.io/docs/fishnet-building-blocks/components/network-observer#component-settings). If you have not familiarized yourself with the ObserverManager and condition types, please do so now using the links above.

A common problem new developers encounter is scene network objects not being enabled for clients. This occurs when the client is not considered part of the scene where the object resides, and the scene condition is preventing that object from spawning for the client. The NetworkManager prefab contains a PlayerSpawner script which adds the player to the current scene; this makes the client an observer for objects in that scene. This requires a player object to be spawned. Should you have made your own NetworkManager object or removed the PlayerSpawner script you will need to add the client to the scene you wish the client to be an observer of.

<div data-full-width="false"><figure><img src="https://1328095063-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MheH2hMo3djr9VSyxTE%2Fuploads%2Fgit-blob-a1811284dcc27fd42275e35933d4ada3e7100e82%2Fplayer-spawner-component.png?alt=media" alt=""><figcaption><p>The "Add To Default Scene" option enabled on the PlayerSpawner</p></figcaption></figure></div>

When encountering such an issue you may of course also remove the ObserverManager or scene condition from the ObserverManager, but this is not recommended as objects in other scenes will attempt to spawn for clients which do not occupy such scenes. Alternatively, you may add the client to the scene where the objects reside; there's a variety of ways to accomplish this.

You can use a script such as the following on an object in the scene. But be careful not to place it on a potentially DDoL object such as the NetworkManager.

{% code expandable="true" %}

```csharp
using FishNet;
using FishNet.Connection;
using UnityEngine;

public class InitialSceneObserver : MonoBehaviour
{
    private void Start()
    {
        NetworkManager networkManager = InstanceFinder.NetworkManager;
        if (networkManager != null)
            networkManager.SceneManager.OnClientLoadedStartScenes += OnClientLoadedStartScenes;
    }

    private void OnDestroy()
    {
        NetworkManager networkManager = InstanceFinder.NetworkManager;
        if (networkManager != null)
            networkManager.SceneManager.OnClientLoadedStartScenes -= OnClientLoadedStartScenes;
    }

    private void OnClientLoadedStartScenes(NetworkConnection conn, bool asServer)
    {
        if (!asServer)
            return;

        if (!conn.Scenes.Contains(gameObject.scene))
            InstanceFinder.NetworkManager.SceneManager.AddConnectionToScene(conn, gameObject.scene);
    }
}
```

{% endcode %}

Under the assumption you removed the PlayerSpawner and/or are not using *SceneManager.AddOwnerToDefaultScene* or the method above, then you must load the client into the scene using the SceneManager. Clients are only considered networked into scenes when those scenes are loaded using the SceneManager. Clients may become part of a scene by loading a scene globally or by loading a scene for a specific client (connection). See the [SceneManager](https://fish-networking.gitbook.io/docs/guides/features/scene-management) section for more information on how to manage networked client scenes as well understand the difference between global and connection scenes.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fish-networking.gitbook.io/docs/guides/features/observers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
