示例#1
0
        public void HandleSetUnitProfile(UnitProfile newUnitProfile)
        {
            //Debug.Log("NewGamePanel.HandleSetUnitProfile(" + newUnitProfile.DisplayName + ")");

            characterPreviewPanel.ReloadUnit();
            characterPanel.SetUnitProfile(newUnitProfile);
        }
        public void SetupScriptableObjects()
        {
            if (prerequisiteConditions != null)
            {
                foreach (PrerequisiteConditions tmpPrerequisiteConditions in prerequisiteConditions)
                {
                    if (tmpPrerequisiteConditions != null)
                    {
                        tmpPrerequisiteConditions.SetupScriptableObjects(this);
                    }
                }
            }

            unitProfiles = new List <UnitProfile>();
            if (unitProfileNames != null)
            {
                foreach (string unitProfileName in unitProfileNames)
                {
                    if (unitProfileName != null && unitProfileName != string.Empty)
                    {
                        UnitProfile unitProfile = SystemUnitProfileManager.MyInstance.GetResource(unitProfileName);
                        if (unitProfile != null)
                        {
                            unitProfiles.Add(unitProfile);
                        }
                    }
                }
            }
        }
示例#3
0
        public void SetupScriptableObjects()
        {
            if (SystemGameManager.MyInstance == null)
            {
                Debug.LogError(gameObject.name + ": System Game Manager Not Found In The Scene.");
                return;
            }
            if (prerequisiteConditions != null)
            {
                foreach (PrerequisiteConditions tmpPrerequisiteConditions in prerequisiteConditions)
                {
                    if (tmpPrerequisiteConditions != null)
                    {
                        //Debug.Log(gameObject.name + ".SetupScriptableObjects(): setting up prerequisites");
                        tmpPrerequisiteConditions.SetupScriptableObjects(this);

                        // add this so unit spawn nodes can have their prerequisites properly set on the first check
                        tmpPrerequisiteConditions.UpdatePrerequisites(false);
                    }
                }
            }

            unitProfiles = new List <UnitProfile>();
            if (unitProfileNames != null)
            {
                foreach (string unitProfileName in unitProfileNames)
                {
                    if (unitProfileName != null && unitProfileName != string.Empty)
                    {
                        UnitProfile unitProfile = SystemUnitProfileManager.MyInstance.GetResource(unitProfileName);
                        if (unitProfile != null)
                        {
                            unitProfiles.Add(unitProfile);
                        }
                        else
                        {
                            Debug.LogError(gameObject.name + ": Unit Profile: " + unitProfileName + " not found while initializing Unit Unit Spawn Node.  Check Inspector!");
                        }
                    }
                }
            }

            if (unitToughness == null && defaultToughness != null && defaultToughness != string.Empty)
            {
                UnitToughness tmpToughness = SystemUnitToughnessManager.MyInstance.GetResource(defaultToughness);
                if (tmpToughness != null)
                {
                    unitToughness = tmpToughness;
                }
                else
                {
                    Debug.LogError("Unit Toughness: " + defaultToughness + " not found while initializing Unit Profiles.  Check Inspector!");
                }
            }
        }
示例#4
0
        /*
         * public override GameObject GetCloneSource() {
         *  return unitProfile.UnitPrefab;
         * }
         */

        public void HandleOpenWindow(UnitProfile unitProfile)
        {
            //Debug.Log("CharacterCreatorManager.HandleOpenWindow()");

            if (unitProfile == null)
            {
                Debug.Log("CharacterCreatorManager.HandleOpenWindow(): unitProfile is null");
                return;
            }
            cloneSource = unitProfile.UnitPrefab;
            if (cloneSource == null)
            {
                return;
            }

            OpenWindowCommon();
        }
示例#6
0
        private void ConfigureThirdPartyController(string resourcesFolder, string prefabFolder)
        {
            EditorUtility.DisplayProgressBar("New Game Wizard", "Creating Third Party Prefabs and Resources...", 0.65f);

            // copy unit profile
            string unitProfileTemplatePath = "/AnyRPG/Core/Templates/Resource/UnitProfile/InvectorUMAPlayerUnitTemplate.asset";

            FileUtil.CopyFileOrDirectory(Application.dataPath + unitProfileTemplatePath, resourcesFolder + "/UnitProfile/InvectorUMAPlayerUnit.asset");
            //AssetDatabase.RenameAsset(resourcesFolder + "/UnitProfile/InvectorUMAPlayerUnitTemplate.asset", "InvectorUMAPlayerUnit.asset");

            // make prefab on disk
            if (thirdPartyCharacterUnit != null)
            {
                string thirdpartyCharacterPrefabPath = FileUtil.GetProjectRelativePath(prefabFolder) + "/" + thirdPartyCharacterUnit.name + ".prefab";
                thirdPartyCharacterPrefab = PrefabUtility.SaveAsPrefabAsset(thirdPartyCharacterUnit, thirdpartyCharacterPrefabPath);

                AssetDatabase.Refresh();

                // link disk prefab into unit profile
                string      unitProfilePath = fileSystemGameName + "/UnitProfile/InvectorUMAPlayerUnit";
                UnitProfile unitProfile     = Resources.Load <UnitProfile>(unitProfilePath);
                if (unitProfile != null)
                {
                    unitProfile.UnitPrefabProps.UnitPrefab = thirdPartyCharacterPrefab;
                }
                else
                {
                    Debug.Log("Could not load resource at " + unitProfilePath);
                }
            }

            AssetDatabase.Refresh();

            // load the invector basic locomotion demo scene and make a prefab out of the camera

            EditorSceneManager.OpenScene("Assets/Invector-3rdPersonController/Basic Locomotion/DemoScenes/Invector_BasicLocomotion.unity");
            GameObject thirdPartyCameraGameObject = GameObject.Find("ThirdPersonCamera");

            if (thirdPartyCameraGameObject != null)
            {
                string thirdpartyCameraPrefabPath = FileUtil.GetProjectRelativePath(prefabFolder) + "/" + thirdPartyCameraGameObject.name + ".prefab";
                thirdPartyCameraPrefab = PrefabUtility.SaveAsPrefabAsset(thirdPartyCameraGameObject, thirdpartyCameraPrefabPath);
            }
        }
示例#7
0
 public override void SetupScriptableObjects(SystemGameManager systemGameManager)
 {
     base.SetupScriptableObjects(systemGameManager);
     if (unitProfileName != null && unitProfileName != string.Empty)
     {
         UnitProfile tmpUnitProfile = systemDataFactory.GetResource <UnitProfile>(unitProfileName);
         if (tmpUnitProfile != null)
         {
             unitProfile = tmpUnitProfile;
         }
         else
         {
             Debug.LogError("MountEffect.SetupScriptableObjects(): Could not find prefab Profile : " + unitProfileName + " while inititalizing " + DisplayName + ".  CHECK INSPECTOR");
         }
     }
     else
     {
         Debug.LogError("MountEffect.SetupScriptableObjects(): Mount effect requires a unit prefab profile but non was configured while inititalizing " + DisplayName + ".  CHECK INSPECTOR");
     }
 }
示例#8
0
        public void SetUnitProfile(UnitProfile newUnitProfile)
        {
            //Debug.Log("NewGameMecanimCharacterPanelController.SetUnitProfile(" + (newUnitProfile == null ? "null" : newUnitProfile.DisplayName) + ")");

            // deselect old button
            if (selectedUnitButton != null && selectedUnitButton.UnitProfile != newUnitProfile)
            {
                selectedUnitButton.DeSelect();
                selectedUnitButton.UnHighlightBackground();
            }

            // select new button
            for (int i = 0; i < optionButtons.Count; i++)
            {
                if (optionButtons[i].UnitProfile == newUnitProfile)
                {
                    selectedUnitButton = optionButtons[i];
                    uINavigationControllers[0].SetCurrentIndex(i);
                    optionButtons[i].HighlightBackground();
                }
            }
        }
示例#9
0
 public virtual void CapturePet(UnitProfile unitProfile, GameObject target)
 {
     // do nothing.  environment effects cannot have pets
 }
示例#10
0
        void OnWizardCreate()
        {
            EditorUtility.DisplayProgressBar("New Game Wizard", "Checking parameters...", 0.1f);

            MakeFileSystemGameName();
            MakeFileSystemFirstSceneName();

            // Check for presence of necessary prefabs
            GameObject gameManagerGameObject = (GameObject)AssetDatabase.LoadMainAssetAtPath(pathToGameManagerPrefab);

            if (gameManagerGameObject == null)
            {
                ShowError("Missing GameManager prefab at " + pathToGameManagerPrefab + ".  Aborting...");
                return;
            }

            string     umaPrefabPath = umaRoot + pathToUMADCSPrefab;
            GameObject umaGameObject = (GameObject)AssetDatabase.LoadMainAssetAtPath(umaPrefabPath);

            if (umaGameObject == null)
            {
                // NOTE: This could be changed to automagically search for the UMA prefab by asset name
                ShowError("Missing UMA prefab at " + umaPrefabPath + ".  Aborting...");
                return;
            }

            // Set default values of game properties just in case they are somehow missing
            if (gameVersion == null || gameVersion.Trim() == "")
            {
                gameVersion = "0.1a";
                Debug.Log("Empty game version.  Defaulting to " + gameVersion);
            }

            if (firstSceneName == null || firstSceneName.Trim() == "")
            {
                firstSceneName           = fileSystemGameName + "Scene";
                fileSystemFirstSceneName = firstSceneName;
                Debug.Log("Empty first scene name.  Defaulting to \"" + fileSystemFirstSceneName + "\"");
            }

            EditorUtility.DisplayProgressBar("New Game Wizard", "Creating Game Folder...", 0.2f);
            // Create root game folder
            string newGameFolder   = GetNewGameFolder();
            string resourcesFolder = newGameFolder + "/Resources/" + fileSystemGameName;

            // create base games folder
            CreateFolderIfNotExists(Application.dataPath + newGameParentFolder);

            EditorUtility.DisplayProgressBar("New Game Wizard", "Copying Game Template Directory...", 0.3f);

            // create game folder structure
            FileUtil.CopyFileOrDirectory(Application.dataPath + pathToNewGameTemplate, newGameFolder);

            AssetDatabase.Refresh();

            EditorUtility.DisplayProgressBar("New Game Wizard", "Renaming Template Folders...", 0.4f);

            // Find every folder with the name of the new game template "TemplateGame" and rename it as necessary
            // This assumes that all folders that have the template name should have their name changed and that only
            // folders will have their name changed
            string[] templateNamedAssets = AssetDatabase.FindAssets(templateName, new string[] { FileUtil.GetProjectRelativePath(newGameFolder) });
            foreach (string templateNamedAssetGuid in templateNamedAssets)
            {
                string namedAssetPath = AssetDatabase.GUIDToAssetPath(templateNamedAssetGuid);
                if (System.IO.Directory.Exists(namedAssetPath))
                {
                    string assetName    = System.IO.Path.GetFileName(namedAssetPath);
                    string newAssetName = namedAssetPath.Replace(templateName, fileSystemGameName);
                    AssetDatabase.RenameAsset(namedAssetPath, fileSystemGameName);
                }
            }
            AssetDatabase.Refresh();

            EditorUtility.DisplayProgressBar("New Game Wizard", "Create Resource Folder If Necessary...", 0.5f);

            // create resources folder if one didn't already get created by the copy operation
            CreateFolderIfNotExists(resourcesFolder);

            EditorUtility.DisplayProgressBar("New Game Wizard", "Making resource folder structure...", 0.6f);
            // Copy over all folders because git won't commit empty folders
            if (System.IO.Directory.Exists(Application.dataPath + pathToResourcesTemplateFolder))
            {
                string[] resourceAssets = AssetDatabase.FindAssets("*", new string[] { "Assets" + pathToResourcesTemplateFolder });
                foreach (string resourceAssetGuid in resourceAssets)
                {
                    string resourceAssetPath     = AssetDatabase.GUIDToAssetPath(resourceAssetGuid);
                    string resourceAssetPathRoot = pathToResourcesTemplateFolder;
                    string relativeAssetPath     = resourceAssetPath.Replace("Assets" + resourceAssetPathRoot + "/", "");
                    // Only directories!
                    //Debug.Log("Checking for " + Application.dataPath + resourceAssetPathRoot + "/" + relativeAssetPath);
                    if (System.IO.Directory.Exists(Application.dataPath + resourceAssetPathRoot + "/" + relativeAssetPath))
                    {
                        System.IO.Directory.CreateDirectory(resourcesFolder + "/" + relativeAssetPath);
                    }
                }
                AssetDatabase.Refresh();
            }
            else
            {
                Debug.LogWarning(pathToResourcesTemplateFolder + " was not found.  Resources folder will be empty.");
            }

            // create prefab folder
            string prefabFolder = newGameFolder + "/Prefab";
            string prefabPath   = FileUtil.GetProjectRelativePath(prefabFolder);

            CreateFolderIfNotExists(prefabFolder);


            if (useThirdPartyController == true)
            {
                EditorUtility.DisplayProgressBar("New Game Wizard", "Creating Third Party Prefabs and Resources...", 0.65f);

                // copy unit profile
                string unitProfileTemplatePath = "/AnyRPG/Engine/Core/Templates/Resource/UnitProfile/InvectorUMAPlayerUnitTemplate.asset";
                FileUtil.CopyFileOrDirectory(Application.dataPath + unitProfileTemplatePath, resourcesFolder + "/UnitProfile/InvectorUMAPlayerUnit.asset");
                //AssetDatabase.RenameAsset(resourcesFolder + "/UnitProfile/InvectorUMAPlayerUnitTemplate.asset", "InvectorUMAPlayerUnit.asset");

                // make prefab on disk
                if (thirdPartyCharacterUnit != null)
                {
                    string thirdpartyCharacterPrefabPath = FileUtil.GetProjectRelativePath(prefabFolder) + "/" + thirdPartyCharacterUnit.name + ".prefab";
                    thirdPartyCharacterPrefab = PrefabUtility.SaveAsPrefabAsset(thirdPartyCharacterUnit, thirdpartyCharacterPrefabPath);

                    AssetDatabase.Refresh();

                    // link disk prefab into unit profile
                    string      unitProfilePath = fileSystemGameName + "/UnitProfile/InvectorUMAPlayerUnit";
                    UnitProfile unitProfile     = Resources.Load <UnitProfile>(unitProfilePath);
                    if (unitProfile != null)
                    {
                        unitProfile.UnitPrefabProps.UnitPrefab = thirdPartyCharacterPrefab;
                    }
                    else
                    {
                        Debug.Log("Could not load resource at " + unitProfilePath);
                    }
                }

                AssetDatabase.Refresh();

                // load the invector basic locomotion demo scene and make a prefab out of the camera

                EditorSceneManager.OpenScene("Assets/Invector-3rdPersonController/Basic Locomotion/DemoScenes/Invector_BasicLocomotion.unity");
                GameObject thirdPartyCameraGameObject = GameObject.Find("ThirdPersonCamera");
                if (thirdPartyCameraGameObject != null)
                {
                    string thirdpartyCameraPrefabPath = FileUtil.GetProjectRelativePath(prefabFolder) + "/" + thirdPartyCameraGameObject.name + ".prefab";
                    thirdPartyCameraPrefab = PrefabUtility.SaveAsPrefabAsset(thirdPartyCameraGameObject, thirdpartyCameraPrefabPath);
                }
            }

            // setup first scene paths
            string existingFirstSceneFolder = FileUtil.GetProjectRelativePath(newGameFolder + "/Scenes/" + defaultFirstSceneName);
            string newFirstSceneFolder      = FileUtil.GetProjectRelativePath(newGameFolder + "/Scenes/" + fileSystemFirstSceneName);
            string newFirstSceneFileName    = fileSystemFirstSceneName + ".unity";
            string newFirstScenePath        = newFirstSceneFolder + "/" + newFirstSceneFileName;
            string existingFirstScenePath   = existingFirstSceneFolder + "/" + defaultFirstSceneName + ".unity";

            // Rename the first scene if necessary
            if (fileSystemFirstSceneName != defaultFirstSceneName)
            {
                EditorUtility.DisplayProgressBar("New Game Wizard", "Renaming First Scene...", 0.7f);
                AssetDatabase.RenameAsset(existingFirstScenePath, newFirstSceneFileName);
                AssetDatabase.RenameAsset(existingFirstSceneFolder, fileSystemFirstSceneName);
                AssetDatabase.Refresh();
            }

            // add the first scene to the build if the option was chosen
            if (addFirstSceneToBuild)
            {
                EditorUtility.DisplayProgressBar("New Game Wizard", "Adding First Scene To Build Settings...", 0.75f);
                List <EditorBuildSettingsScene> currentSceneList = EditorBuildSettings.scenes.ToList();
                currentSceneList.Add(new EditorBuildSettingsScene(newFirstScenePath, true));
                EditorBuildSettings.scenes = currentSceneList.ToArray();
            }

            // Rename the game load scene
            EditorUtility.DisplayProgressBar("New Game Wizard", "Renaming Game Load Scene...", 0.8f);
            string gameLoadSceneFolder       = FileUtil.GetProjectRelativePath(newGameFolder + "/Scenes/" + fileSystemGameName);
            string newGameLoadSceneFileName  = fileSystemGameName + ".unity";
            string newGameLoadScenePath      = gameLoadSceneFolder + "/" + newGameLoadSceneFileName;
            string existingGameLoadScenePath = gameLoadSceneFolder + "/" + templateName + ".unity";

            // Rename the game load scene
            AssetDatabase.RenameAsset(existingGameLoadScenePath, newGameLoadSceneFileName);
            AssetDatabase.Refresh();

            EditorUtility.DisplayProgressBar("New Game Wizard", "Modifying scene...", 0.85f);
            // Open the scene to add the necessary elements
            Debug.Log("Loading Scene at " + newGameLoadScenePath);
            Scene newScene = EditorSceneManager.OpenScene(newGameLoadScenePath);

            // Create a variant of the GameManager & UMA prefabs
            EditorUtility.DisplayProgressBar("New Game Wizard", "Making prefab variants...", 0.9f);
            MakeGameManagerPrefabVariant(gameManagerGameObject, prefabPath + "/GameManager.prefab");
            MakeUMAPrefabVariant(umaGameObject, prefabPath + "/UMA_DCS.prefab", fileSystemGameName);

            EditorUtility.DisplayProgressBar("New Game Wizard", "Saving scene...", 0.95f);
            // Save changes to the scene
            EditorSceneManager.SaveScene(newScene);

            EditorUtility.ClearProgressBar();
            EditorUtility.DisplayDialog("New Game Wizard", "New Game Wizard Complete! The game loading scene can be found at " + newGameLoadScenePath, "OK");
        }
示例#11
0
        public void CommonSpawn(int unitLevel, int extraLevels, bool dynamicLevel, UnitProfile unitProfile, UnitToughness toughness = null)
        {
            //Debug.Log(gameObject.name + ".UnitSpawnNode.CommonSpawn()");

            // prevent a coroutine that finished during a level load from spawning a character
            if (disabled == true)
            {
                return;
            }
            if (unitProfile == null || playerManager.MyCharacter == null)
            {
                return;
            }

            int            _unitLevel     = (dynamicLevel ? playerManager.MyCharacter.CharacterStats.Level : unitLevel) + extraLevels;
            UnitController unitController = unitProfile.SpawnUnitPrefab(null, transform.position, transform.forward, UnitControllerMode.AI, _unitLevel);

            if (unitController == null)
            {
                // something went wrong.  None of the code below will work, so might as well return
                return;
            }

            Vector3 newSpawnLocation = Vector3.zero;
            Vector3 newSpawnForward  = Vector3.forward;

            // lookup persistent position, or use navmesh agent to get a valid position (in case this spawner was not placed on walkable terrain)
            if (unitController.PersistentObjectComponent.PersistObjectPosition == true)
            {
                //Debug.Log(gameObject.name + ".UnitSpawnNode.CommonSpawn(): persist ojbect position is true");
                PersistentState persistentState = unitController.PersistentObjectComponent.GetPersistentState();
                if (persistentState != null)
                {
                    // since we will be using navMeshAgent.warp, do not attempt to move unit manually
                    unitController.PersistentObjectComponent.MoveOnStart = false;
                    newSpawnLocation = persistentState.Position;
                    newSpawnForward  = persistentState.Forward;
                }
                else
                {
                    newSpawnLocation = GetSpawnLocation();
                    newSpawnForward  = transform.forward;
                }
            }
            else
            {
                newSpawnLocation = GetSpawnLocation();
                newSpawnForward  = transform.forward;
            }

            // now that we have a good final position and rotation, set it
            unitController.StartPosition = newSpawnLocation;
            unitController.NavMeshAgent.Warp(newSpawnLocation);
            unitController.transform.forward = newSpawnForward;


            //Debug.Log("UnitSpawnNode.Spawn(): afterMove: navhaspath: " + navMeshAgent.hasPath + "; isOnNavMesh: " + navMeshAgent.isOnNavMesh + "; pathpending: " + navMeshAgent.pathPending);
            CharacterUnit _characterUnit   = null;
            CharacterUnit tmpCharacterUnit = unitController.CharacterUnit;

            if (tmpCharacterUnit == null)
            {
                Debug.LogError("Interactable had no characterUnit");
                return;
            }
            _characterUnit = tmpCharacterUnit;

            if (respawnOn == respawnCondition.Despawn)
            {
                _characterUnit.OnDespawn += HandleDespawn;
            }
            else if (respawnOn == respawnCondition.Loot)
            {
                LootableCharacterComponent tmpLootableCharacter = LootableCharacterComponent.GetLootableCharacterComponent(unitController);
                if (tmpLootableCharacter != null)
                {
                    // there can only be one of these types of object on an interactable
                    // interesting note : there is no unsubscribe to this event.  Unit spawn nodes exist for the entire scene and are only destroyed at the same time as the interactables
                    // should we make an unsubscribe anyway even though it would never be called?
                    tmpLootableCharacter.OnLootComplete += HandleLootComplete;
                }
            }
            else if (respawnOn == respawnCondition.Death)
            {
                if (_characterUnit.BaseCharacter != null && _characterUnit.BaseCharacter.CharacterStats != null)
                {
                    _characterUnit.BaseCharacter.CharacterStats.OnDie += HandleDie;
                }
            }
            // don't override an existing toughness
            if (_characterUnit.BaseCharacter.UnitToughness == null && toughness != null)
            {
                //Debug.Log("UnitSpawnNode.Spawn(): setting toughness to null on gameObject: " + spawnReference.name);
                _characterUnit.BaseCharacter.SetUnitToughness(toughness, true);
            }
            unitController.Init();
            spawnReferences.Add(unitController);
        }
示例#12
0
 public void ManualSpawn(int unitLevel, int extraLevels, bool dynamicLevel, UnitProfile unitProfile, UnitToughness toughness)
 {
     CommonSpawn(unitLevel, extraLevels, dynamicLevel, unitProfile, toughness);
 }
        void OnWizardCreate()
        {
            EditorUtility.DisplayProgressBar("New Character Wizard", "Checking parameters...", 0.1f);

            SetUnitPrefab();

            EditorUtility.DisplayProgressBar("New Character Wizard", "Creating Resources Subfolder...", 0.2f);
            // Create root game folder
            string newGameFolder   = GetNewGameFolder();
            string resourcesFolder = newGameFolder + "/Resources/" + fileSystemGameName + "/UnitProfile";

            // create resources folder
            CreateFolderIfNotExists(resourcesFolder);

            AssetDatabase.Refresh();

            EditorUtility.DisplayProgressBar("New Character Wizard", "Creating Unit Profile...", 0.3f);
            UnitProfile asset = ScriptableObject.CreateInstance("UnitProfile") as UnitProfile;

            EditorUtility.DisplayProgressBar("New Character Wizard", "Configuring Unit Profile...", 0.4f);
            // setup unit profile properties
            asset.ResourceName           = characterName;
            asset.CharacterName          = characterName;
            asset.AutomaticPrefabProfile = false;
            asset.UseInlinePrefabProps   = true;

            // setup unit prefab properties
            asset.UnitPrefabProps.UnitPrefab              = unitPrefab;
            asset.UnitPrefabProps.ModelPrefab             = characterModel;
            asset.UnitPrefabProps.RotateModel             = true;
            asset.UnitPrefabProps.UseInlineAnimationProps = true;

            // setup animation properties
            asset.UnitPrefabProps.AnimationProps = animations;

            // setup nameplate properties
            asset.UnitPrefabProps.NamePlateProps.UnitFrameTarget           = headBone;
            asset.UnitPrefabProps.NamePlateProps.OverrideNameplatePosition = true;
            asset.UnitPrefabProps.NamePlateProps.NameplatePosition         = new Vector3(0f, highestYTransform + namePlateHeightAdd, 0f);
            // set the look position at half the height
            asset.UnitPrefabProps.NamePlateProps.UnitPreviewCameraLookOffset = new Vector3(0f, highestYTransform / 2f, 0f);
            // zoom out to 1.25 times the height
            asset.UnitPrefabProps.NamePlateProps.UnitPreviewCameraPositionOffset = new Vector3(0f, highestYTransform / 2f, highestYTransform * 1.25f);

            // setup foootstep properties
            asset.MovementAudioProfileNames.Add(defaultFootstepLoop);

            EditorUtility.DisplayProgressBar("New Character Wizard", "Saving Unit Profile...", 0.5f);

            scriptableObjectPath = "Assets" + newGameParentFolder + fileSystemGameName + "/Resources/" + fileSystemGameName + "/UnitProfile/" + GetFileSystemCharactername(characterName) + "Unit.asset";
            AssetDatabase.CreateAsset(asset, scriptableObjectPath);

            AssetDatabase.Refresh();

            EditorUtility.DisplayProgressBar("New Character Wizard", "Checking Default Player Unit Setting...", 0.6f);
            if (setAsDefaultPlayerCharacter == true && systemConfigurationManager != null)
            {
                SystemConfigurationManager diskSystemConfigurationManager = PrefabUtility.GetCorrespondingObjectFromSource <SystemConfigurationManager>(systemConfigurationManager);
                if (diskSystemConfigurationManager != null)
                {
                    diskSystemConfigurationManager.DefaultPlayerUnitProfileName = characterName;
                    EditorUtility.SetDirty(diskSystemConfigurationManager);
                    AssetDatabase.SaveAssets();
                    AssetDatabase.Refresh();

                    // this next bit is due to a unity bug? where scene objects are not reimported when modified through script

                    /*
                     * Object realGO = PrefabUtility.GetCorrespondingObjectFromSource(systemConfigurationManager);
                     * string selectedPath = AssetDatabase.GetAssetPath(realGO);
                     * Debug.Log(selectedPath);
                     * AssetDatabase.ImportAsset(selectedPath);
                     */

                    //EditorApplication.RepaintHierarchyWindow();
                    //SceneManager.UnloadSceneAsync(SceneManager.GetActiveScene().buildIndex);
                    //Resources.UnloadUnusedAssets();
                    //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex, LoadSceneMode.Single);
                }
            }

            EditorUtility.ClearProgressBar();
            EditorUtility.DisplayDialog("New Character Wizard", "New Character Wizard Complete! The character UnitProfile can be found at " + scriptableObjectPath, "OK");
        }