From 111378de945d9c59ef38f0e8a73b5faabea74353 Mon Sep 17 00:00:00 2001
From: guizix <46198159+guizix@users.noreply.github.com>
Date: Thu, 29 Jun 2023 13:09:43 +0800
Subject: [PATCH] Add Attribute PortTypeOverride
---
Scripts/Attributes/PortTypeOverrideAttribute.cs | 12 ++++++++++++
Scripts/Attributes/PortTypeOverrideAttribute.cs.meta | 11 +++++++++++
2 files changed, 23 insertions(+)
create mode 100644 Scripts/Attributes/PortTypeOverrideAttribute.cs
create mode 100644 Scripts/Attributes/PortTypeOverrideAttribute.cs.meta
diff --git a/Scripts/Attributes/PortTypeOverrideAttribute.cs b/Scripts/Attributes/PortTypeOverrideAttribute.cs
new file mode 100644
index 0000000..316ca2d
--- /dev/null
+++ b/Scripts/Attributes/PortTypeOverrideAttribute.cs
@@ -0,0 +1,12 @@
+using System;
+/// Overrides the ValueType of the Port, to have a ValueType different from the type of its serializable field
+/// Especially useful in Dynamic Port Lists to create Value-Port Pairs with different type.
+[AttributeUsage(AttributeTargets.Field)]
+public class PortTypeOverrideAttribute : Attribute {
+ public Type type;
+ /// Overrides the ValueType of the Port
+ /// ValueType of the Port
+ public PortTypeOverrideAttribute(Type type) {
+ this.type = type;
+ }
+}
diff --git a/Scripts/Attributes/PortTypeOverrideAttribute.cs.meta b/Scripts/Attributes/PortTypeOverrideAttribute.cs.meta
new file mode 100644
index 0000000..a587759
--- /dev/null
+++ b/Scripts/Attributes/PortTypeOverrideAttribute.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1410c1437e863ab4fac7a7428aaca35b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: