Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Adding allowMultiple to the descriptor attribute #607

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/Sandbox.Game/Game/World/MyScriptManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ private void TryAddEntityScripts(MyModContext context, Assembly assembly)
foreach (var type in assembly.GetTypes())
{
var descriptorArray = type.GetCustomAttributes(typeof(MyEntityComponentDescriptor), false);
if (descriptorArray != null && descriptorArray.Length > 0)
foreach (var descriptorAttribute in descriptorArray)
{
var descriptor = (MyEntityComponentDescriptor)descriptorArray[0];
var descriptor = (MyEntityComponentDescriptor)descriptorAttribute;
try
{
var component = (MyGameLogicComponent)Activator.CreateInstance(type);
Expand Down
2 changes: 1 addition & 1 deletion Sources/VRage.Game/Components/MyEntityComponentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace VRage.Game.Components
{
[AttributeUsage(AttributeTargets.Class)]
[AttributeUsage(AttributeTargets.Class, AllowMultiple=true)]
public class MyEntityComponentDescriptor : System.Attribute
{
public Type EntityBuilderType;
Expand Down