Info
ICondition - a bool you can evaluate and observe. Module Polis.Core.Conditions
- Used to show, enable or skip things without code: load items, toggle triggers, wedges, assigners
- The inspector shows a green or red icon with the current result
Usage
bool Evaluate() - current result
event Action StateChanged - fires when the result may have changed
InitializeObserving() / TerminateObserving() - start and stop watching the source
ObserveDisposable(Action) extension - subscribes to StateChanged and starts observing, disposing the result undoes both
Ready made conditions
- General
CompositeCondition - all (AND) or any (OR) of its child conditions are true
ConstantCondition - always true, or never with IsFalse
PlatformCondition - running on one of the selected platforms
EditorCondition - running in the Unity editor
HeadlessCondition - a player without graphics: dedicated server builds and players started with -nographics
DefineCondition - a define of the build is set (ActiveDefinesRegistry), also the version defines of packages, e.g. PURRNET
PollingConditionWrapper - re-checks a condition on an interval, for conditions without an event (needs R3)
- XR
XRCondition - XR is running, optionally also the simulator
XRSimulatorEnabledCondition - the XR device simulator is switched on
LaserPointerActiveCondition - the laser pointer is on in a hand
InteractableSelectedCondition / InteractableHoveredCondition / InteractableActivatedCondition - state of an XR interactable
TouchscreenCondition - a touch screen is connected
- Networking
NetworkConnectionStateCondition - connection state is one of the selected
NetworkRuntimeModeCondition - runtime mode is one of the selected, e.g. host only UI
NetworkOwnerCondition - the local player owns the object
- Other modules
LoggedInCondition - a ServiceHub user is logged in
SaveDataUnsavedCondition - some save data was refused by the server and is only kept on this device
MicAllowedCondition - the microphone is allowed
LoadItemAvailableCondition - a load item is part of the active load setup
AddressableInContentCondition - an asset is in this build's Addressables content, e.g. groups some platforms leave out. True in edit mode
ReleaseContentAvailableCondition - the app loads release content, e.g. to show the Content settings
ViewStateCondition - a view node is in the given state
WindowOpenCondition - a window is open (also minimized), shown, or in front of its layer
EyeTrackingSupportedCondition - the headset supports eye tracking (Oculus, false elsewhere)
Where conditions are used
ConditionalToggleTrigger - drives an AToggleState. With Observe Condition it updates on StateChanged. No condition counts as true
AScriptableAssigner - assigns only while the condition holds
ConditionalVariableFieldData<T> - picks one of two values
- Load items - skipped when false, e.g. the kit crash reporting load item loads only with the
SENTRY define (DefineCondition)
- Action wheel wedges - visible, unlocked and on state