Beispiel #1
0
        /// <summary>
        /// Gets the UClass address for the given path (e.g. "/Script/Engine.Actor")
        /// </summary>
        /// <param name="path">The path of the object/class</param>
        /// <returns>The UClass address</returns>
        public static IntPtr GetClassAddress(string path)
        {
            IntPtr address = NativeReflection.FindObject(Classes.UClass, IntPtr.Zero, path, false);

            if (address == IntPtr.Zero)
            {
                FName newPath = FLinkerLoad.FindNewNameForClass(new FName(path), false);
                if (newPath != FName.None)
                {
                    address = NativeReflection.FindObject(Classes.UClass, IntPtr.Zero, newPath.ToString(), false);
                }
            }
            return(address);
        }
Beispiel #2
0
        /// <summary>
        /// Gets the UClass for the given path (e.g. "/Script/Engine.Actor")
        /// </summary>
        /// <param name="path">The path of the object/class</param>
        /// <returns>The UClass for the given path</returns>
        public static UClass GetClass(string path)
        {
            UClass foundClass = UObject.FindObject <UClass>(UObject.AnyPackage, path);

            if (foundClass == null)
            {
                // Look for class redirectors
                FName newPath = FLinkerLoad.FindNewNameForClass(new FName(path), false);

                if (newPath != FName.None)
                {
                    foundClass = UObject.FindObject <UClass>(UObject.AnyPackage, newPath.ToString());
                }
            }
            return(foundClass);
        }
Beispiel #3
0
        /// <summary>
        /// Gets the UStruct/UClass for the given path (e.g. "/Script/Engine.HitResult")
        /// </summary>
        /// <param name="path">The path of the object/struct</param>
        /// <returns>The UStruct/UClass for the given path</returns>
        public static UStruct GetStructOrClass(string path)
        {
            UStruct foundStruct = UObject.FindObject <UStruct>(UObject.AnyPackage, path);

            if (foundStruct == null)
            {
                // Look for redirectors
                FName newPath = FLinkerLoad.FindNewNameForStruct(new FName(path));
                if (newPath != FName.None)
                {
                    foundStruct = UObject.FindObject <UStruct>(UObject.AnyPackage, newPath.ToString());
                }

                if (foundStruct == null)
                {
                    newPath = FLinkerLoad.FindNewNameForClass(new FName(path), false);
                    if (newPath != FName.None)
                    {
                        foundStruct = UObject.FindObject <UClass>(UObject.AnyPackage, newPath.ToString());
                    }
                }
            }
            return(foundStruct);
        }