public void SetClass(UClass unrealClass) { if (unrealClass != null && !unrealClass.IsA <T>()) { throw new Exception("TAssetClass - tried to set class with the wrong target class type. Expected:" + typeof(T) + " Actual:" + UClass.GetType(unrealClass.Address)); } softObject.Value = unrealClass; }
/// <summary> /// Gets the default object of a class. /// </summary> /// <typeparam name="T">The object type</typeparam> /// <param name="unrealClass">The class to get the CDO for.</param> /// <returns>Class default object (CDO).</returns> public static T GetDefault <T>(UClass unrealClass) where T : UObject { if (unrealClass != null && unrealClass.IsA <T>()) { UObject defaultObject = unrealClass.GetDefaultObject(); if (defaultObject.IsA <T>()) { return(defaultObject as T); } } return(null); }
public void SetClass(UClass unrealClass) { if (unrealClass != null) { if (!unrealClass.IsA <T>()) { throw new Exception("TSubclassOf - tried to set class with the wrong target class type. Expected:" + typeof(T) + " Actual:" + UClass.GetType(unrealClass.Address)); } subclassOf.ClassAddress = unrealClass.Address; } else { subclassOf.ClassAddress = IntPtr.Zero; } }
/// <summary> /// Blueprints will always have return values as out values. If there is a single out value treat it /// as the return value instead. /// </summary> internal UProperty GetBlueprintReturnProperty() { UClass owner = GetOwnerClass(); bool isBlueprintType = owner != null && owner.IsA <UBlueprintGeneratedClass>(); if (!isBlueprintType) { return(null); } if (GetReturnProperty() != null) { return(null); } UProperty returnProperty = null; foreach (UProperty parameter in GetFields <UProperty>()) { if (!parameter.HasAnyPropertyFlags(EPropertyFlags.Parm)) { continue; } if (parameter.HasAnyPropertyFlags(EPropertyFlags.OutParm) && !parameter.HasAnyPropertyFlags(EPropertyFlags.ReferenceParm)) { if (returnProperty != null) { return(null); } returnProperty = parameter; } } return(returnProperty); }