Class ClassifiedDistanceCondition
A FishNet.Component.Observing.DistanceCondition that also declares what kind of thing it is gating and how many of that kind one viewer may observe at a time.
[CreateAssetMenu(menuName = "FishMMO/Observers/Classified Distance Condition", fileName = "NewClassifiedDistanceCondition")]
public class ClassifiedDistanceCondition : DistanceCondition, IOrderable
- Inheritance
-
ObjectScriptableObjectObserverConditionDistanceConditionClassifiedDistanceCondition
- Implements
-
IOrderable
- Inherited Members
-
DistanceCondition.MaximumDistanceDistanceCondition.GetMaximumDistance()DistanceCondition.GetConditionType()ObserverCondition.NetworkObjectObserverCondition.OrderObserverCondition.IsConstantObserverCondition.GetIsEnabled()ObserverCondition.Initialize(NetworkObject)ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
One asset per classification is the whole configuration surface. Adding a kind of
entity to the interest-management system is: create one of these under
Assets/Settings/ObserverConditions, pick its Classification, set its
distance and its budget, and reference it from the prefab's NetworkObserver. Nothing
in code needs to learn the new kind — the registry reads the classification off the object's
own condition list.
Range and budget are different questions and both are needed. The range answers "how far can this be seen from", and alone it bounds nothing: a hundred players can stand inside any radius you pick. The budget answers "how many of these may one client hold at once", and alone it says nothing about where they are. Keeping both on one asset is what makes the pair legible — a reviewer can see that Titans reach 1000 m and are never culled, while dropped items reach 40 m and are capped, without cross-referencing two files.
The grid still applies unless the prefab opts out. FishNet's GridCondition is
ANDed with this one and rejects anything more than HashGrid._accuracy away on an axis,
so a range beyond half the accuracy is dead configuration — the trap that once made a 100 m
player range really 35–70 m. A classification that needs to outrun the grid (Titan) must be
on a prefab whose NetworkObserver is set to IgnoreManager and which declares
its own conditions; raising the global accuracy instead would make the grid a no-op for
every other object in the world.
PredictionAuditRegressionTests.HashGridAccuracy_CannotClipTheDistanceConditions
enforces this per prefab.
Properties
AuthoredVisibilityBudget
The budget exactly as authored on this asset, ignoring any server override.
public int AuthoredVisibilityBudget { get; }
Property Value
Classification
What kind of entity this condition gates.
public ObserverClassification Classification { get; }
Property Value
VisibilityBudget
How many objects of this classification one client may observe at once, after any server configuration override. 0 means unlimited.
public int VisibilityBudget { get; }
Property Value
Remarks
The authored value is the default and the server key is the override, in the same direction as every other tunable here: designers set what the game should be, operators adjust what a particular deployment can afford. Read through ResolveVisibilityBudget(ObserverClassification, int) so both paths agree.