Example #1
0
        public UPackage GetPackage()
        {
            if (PackageName == FName.None)
            {
                return(null);
            }

            UPackage package = UObject.FindPackage(null, PackageName.ToString());

            if (package != null)
            {
                package.FullyLoad();
            }
            else
            {
                package = UObject.LoadPackage(null, PackageName.ToString(), ELoadFlags.None);
            }
            return(package);
        }
Example #2
0
        private static UPackage FindOrLoadPackage(string pathName)
        {
            // If there is a dot, remove it.
            int packageDelimPos = pathName.IndexOf('.');

            if (packageDelimPos != -1)
            {
                pathName = pathName.Remove(packageDelimPos, 1);
            }

            // Find the package in memory.
            UPackage package = UObject.FindPackage(null, pathName);

            if (package == null)
            {
                // If it is not in memory, try to load it.
                package = UObject.LoadPackage(null, pathName, ELoadFlags.None);
            }
            if (package != null)
            {
                package.AddToRoot();
            }
            return(package);
        }