Class EntityRegAttribute
An Attribute used to describe entities. This should be used to register new entities by adding attaching it to an entity's class.
Inheritance
Implements
Inherited Members
Namespace: DuneNet.Shared.Entities
Assembly: DuneNet.Shared.dll
Syntax
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class EntityRegAttribute : Attribute, _Attribute
Constructors
EntityRegAttribute(String, String, NetworkContext, String)
Constructor.
Declaration
public EntityRegAttribute(string name, string prefabPath, NetworkContext context, string assetBundle = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The registration name of the entity. |
System.String | prefabPath | The relative path to the prefab of the entity.
The path starts inside the Resources folder once it has been mounted by Unity and should not contain the extension.
|
NetworkContext | context | The network context the entity will be used on. Servers cannot spawn client entities and vice versa. |
System.String | assetBundle |
Properties
AssetBundle
The name of the Asset Bundle where the entity prefab is stored
Declaration
public string AssetBundle { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
If this is null or empty, the entity prefab is loaded from the Resources folder.
Context
The network context the entity will be used on.
Declaration
public NetworkContext Context { get; }
Property Value
Type | Description |
---|---|
NetworkContext |
Remarks
Servers cannot spawn client entities and vice versa.
Name
The registration name of the entity.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
PrefabPath
The relative path to the prefab of the entity.
Declaration
public string PrefabPath { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The path starts inside the Resources folder once it has been mounted by Unity and should not contain the extension.
If using Asset Bundles, this should be the path to the prefab inside the Asset Bundle instead.