-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the ObjectReplicatorDemo wiki!
- Download the ObjectReplicator plugin in FAB and then enable it in your project.
- If you downloaded the plugin from another source, place it in your project folder. The plugin path will look like this:
YourProject/Plugins/ObjectReplicator
With this plugin you can replicate UObject inside a component. The plugin consists of an object and a component:
-
ReplicatedObject- This is a replicated object, within which any variables can also be replicated. When creating this object, try to specify the owner as the same Actor in which the ReplicatedObjectContainer component is located. -
ReplicatedObjectContainer- This is a component that contains an array of replicated objects. This component already has a set of functions for working with an array, with automatic registration of objects for replication.
You can use a replicated object for different systems, for example, to create inventory or various effects (buffs, debuffs).
Now, as an example, we will create a simple inventory system.
- Create a new blueprint that inherits from ReplicatedObject. I'll call it
BP_ItemBase
- Open this blueprint and add two variables
ItemNameandItemCount
- Make the
ItemCountvariable replicated as RepNotify
- Add the
OnItemCountUpdateddelegate
- Convert the
OnRep_ItemCountfunction to an Event and call this delegate there.
- For convenience, add several functions to change the
ItemCountvariable.
- Also add the
ItemTexturevariable!
- Create two child blueprints from
BP_ItemBase. I'll call themBP_AppleItemandBP_WoodItem
- Open these blueprints and set some values there
- Open your character and add a **
ReplicatedObjectContainercomponent to it
- Add some test functions inside your character
- Create two widgets, name them:
W_Item,W_PlayerHUD
- Open B_Item. Add widget components in the following order.
- Border ** HorizontalBox *** SizeBox **** Image (ItemTexture) *** Text (ItemName) *** Text (ItemCount)