public void AddCppProperty(UProperty property) { Native_UField.AddCppProperty(Address, property.Address); }
private IntPtr CreateProperty(IntPtr outer, Type type, string propertyName, EPropertyType propertyType, EPropertyType innerPropertyType1, EPropertyType innerPropertyType2) { propertyType = ManagedUnrealTypes.GetPropertyType(type, propertyType); IntPtr propertyClass = ManagedUnrealTypes.GetPropertyClass(propertyType); if (propertyClass == IntPtr.Zero) { return(IntPtr.Zero); } EObjectFlags objectFlags = EObjectFlags.Public | EObjectFlags.Transient | EObjectFlags.MarkAsNative; IntPtr property = NativeReflection.NewObject(outer, propertyClass, new FName(propertyName), objectFlags); Native_UProperty.SetPropertyFlags(property, EPropertyFlags.BlueprintVisible | EPropertyFlags.BlueprintAssignable | EPropertyFlags.Edit); // Set type specific information switch (propertyType) { case EPropertyType.Array: if (!firstRun) { Native_UArrayProperty.Set_Inner(property, CreateProperty(property, typeof(int), propertyName, innerPropertyType1)); } else { Native_UArrayProperty.Set_Inner(property, CreateProperty(property, type.GenericTypeArguments[0], propertyName, innerPropertyType1)); } break; case EPropertyType.Set: Native_USetProperty.Set_ElementProp(property, CreateProperty(property, type.GenericTypeArguments[0], propertyName, innerPropertyType1)); break; case EPropertyType.Map: Native_UMapProperty.Set_KeyProp(property, CreateProperty(property, type.GenericTypeArguments[0], propertyName, innerPropertyType1)); Native_UMapProperty.Set_ValueProp(property, CreateProperty(property, type.GenericTypeArguments[1], propertyName, innerPropertyType2)); break; case EPropertyType.Class: Native_UClassProperty.SetMetaClass(property, UClass.GetClass(type.GenericTypeArguments[0]).Address); break; case EPropertyType.Object: var v1 = ManagedUnrealTypes.GetStaticClass(type); var v2 = ManagedUnrealTypes.GetStaticClass(typeof(UObject)); Native_UObjectPropertyBase.SetPropertyClass(property, v1 == IntPtr.Zero ? v2 : v1); break; case EPropertyType.LazyObject: case EPropertyType.WeakObject: case EPropertyType.SoftObject: Native_UObjectPropertyBase.SetPropertyClass(property, UClass.GetClass(type.GenericTypeArguments[0]).Address); break; case EPropertyType.SoftClass: Native_USoftClassProperty.SetMetaClass(property, UClass.GetClass(type.GenericTypeArguments[0]).Address); break; case EPropertyType.Enum: Native_UEnumProperty.SetEnum(property, ManagedUnrealTypes.GetEnum(type)); break; case EPropertyType.Delegate: //Native_UDelegateProperty.Set_SignatureFunction(property, ManagedUnrealTypes.GetSignatureFunction(type)); break; case EPropertyType.MulticastDelegate: //Native_UMulticastDelegateProperty.Set_SignatureFunction(property, ManagedUnrealTypes.GetSignatureFunction(type)); break; } Native_UField.AddCppProperty(outer, property); return(property); }