Unreal Networking Features🔗
Unreal networking features are supported to a similar extent as they are in blueprint.
UFUNCTION()
s can be marked as NetMulticast
, Client
, Server
and/or BlueprintAuthorityOnly
in their specifiers, functioning much the same as they do in C++. The function body will
automatically be used as an RPC, whether calling it from angelscript or blueprint.
Unlike C++, angelscript RPC functions default to being reliable. If you want an unreliable
RPC message, put the Unreliable
specifier in the UFUNCTION()
declaration.
UPROPERTY()
s can be marked as Replicated
. Optionally, you can set a condition for
their replication as well, similar to the dropdown for blueprint properties. This can be
done with the ReplicationCondition
specifier.
Similar to C++ and Blueprint networking, in order for RPCs and replicated properties to
work, the actor and component need to be set to replicate. In angelscript this can
be done using default
statements.
Example:
Available conditions for ReplicationCondition
match the ELifetimeCondition enum in C++, and are as follows:
- None
- InitialOnly
- OwnerOnly
- SkipOwner
- SimulatedOnly
- AutonomousOnly
- SimulatedOrPhysics
- InitialOrOwner
- Custom
- ReplayOrOwner
- ReplayOnly
- SimulatedOnlyNoReplay
- SimulatedOrPhysicsNoReplay
- SkipReplay
It is also possible to specify ReplicatedUsing
on a replicated UPROPERTY
that will be called whenever
the value of that property is replicated. Note that any function used with ReplicatedUsing
must be
declared as a UFUNCTION()
so it is visible to unreal.