Hello! I started to use UFE2 for a new prototype as a sub module besides a board game. Therefor it is necessary to load and unload the UFE2 scene. The first time the game starts a battle everything is working. But if the scene with the UFE object is being loaded a second time it stops because of weird behaviours. target platform is mobile. I need to switch scenes because of memory issues.
MissingReferenceException: The object of type 'Image' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
DefaultBattleGUI.OnGameBegin (ControlsScript cPlayer1, ControlsScript cPlayer2, UFE3D.StageOptions stage) (at Assets/UFE/Engine/Scripts/UI_Templates/DefaultBattleGUI.cs:417)
UFE.FireGameBegins () (at Assets/UFE/Engine/Scripts/Core/Manager/UFE.cs:822)
UFE._StartGame (System.Single fadeTime) (at Assets/UFE/Engine/Scripts/Core/Manager/UFE.cs:1335)
UFE+<>c__DisplayClass394_0.<StartGame>b__0 () (at Assets/UFE/Engine/Scripts/Core/Manager/UFEPart.cs:347)
UFE.ExecuteLocalDelayedActions () (at Assets/UFE/Engine/Scripts/Core/Manager/UFE.cs:361)
UFE3D.GameManager.UpdateGameState (System.Int64 currentFrame) (at Assets/UFE/Engine/Scripts/Core/Manager/GameManager.cs:146)
UFE3D.GameManager.DoFixedUpdate () (at Assets/UFE/Engine/Scripts/Core/Manager/GameManager.cs:18)
UFE.FixedUpdate () (at Assets/UFE/Engine/Scripts/Core/Manager/UFE.cs:1723)
image is part of the DefaultBattleGUI class. It is the content of the array of WonRoundImages.
Because of the crash the Game object and the UI is being instantiated multiple times until memory overflow occurs.
I appreciate every help, hint or solution if this problem is already known.
It depends on how you are loading UFE as a sub module. Are you using the Shell mode template? You can find an example scene here: UFE/Demos/_2DFighter/Shell_Mode/Demo 2D Fighter (Shell).
This video should tell you everything you need (skip to 1:30):
Make sure you add both scenes (Demo 2D Fighter (Shell) and Demo 2D Fighter (Versus Mode Only)) to the βScenes to Buildβ under Build Settings as well as the training room scene listed under Config_2D_Fighter_Basic β Global Editor β Stages (UFE/Demos/Shared_Assets/Stages/TrainingRoom2D/TrainingRoom.unity)
Thank You very much for the quick response. As far as I can see I followed exactly the example. I set up the needed info via script in the global config, then loading the scene containing just the camera and the UFE Manager object. The stage prefab contains all lighting for the scene. And the character configs are set dynamically regarding on the board situation of the board game. The first time the engine initialises completely fine. Th config and setup seem to work. The fight is working without any issue. Returning to the board game scene I am able to fetch the battle result.
But in the moment the Fight scene with the UFE Manager object is being loaded the second time, the Game object and the UI Canvas object in the Fight scene gets initialised multiple times. The scene is NOT loaded additionally. It is loaded exclusively. The bug happens exactly at the same place every time again (my original post above). If the exception is thrown somehow it starts again to instantiate the objects again and again. Why? It would be easier to debug if it wouldnβt instantiate again and again. I also donβt understand how the instance of a reference inside a prefab could be destroyed at runtime in this case.
Here the method which initialises the global config and loads the UFE scene:
private void InitializeGlobalInfoForFight()
{
var gridIndexDefender = fightDataSo.Content.playerFightDatas[1].gridIndex;
var gridTile = gridInfoProviderDataSo.Content.GetTileController(gridIndexDefender);
var stageIndex = gridTile.CurrentEnvironmentDimension.StageOptionsIndex;
// I don't know if this is necessary
globalInfo.player1Character = fightDataSo.Content.playerFightDatas[0].playerCard.UfeCharacterInfo;
globalInfo.player2Character = fightDataSo.Content.playerFightDatas[1].playerCard.UfeCharacterInfo;
// This is necessary
globalInfo.selectedStage = globalInfo.stages[stageIndex];
globalInfo.deploymentOptions.deploymentType = DeploymentType.VersusMode;
for (var i = 0; i < 2; i++)
{
globalInfo.deploymentOptions.activeCharacters[i] = fightDataSo.Content.playerFightDatas[i].playerCard.UfeCharacterInfo;
globalInfo.deploymentOptions.AIControlled[i] = fightDataSo.Content.playerFightDatas[i].playerData.IsCPU || playAsCPUAnyway;
}
globalInfo.deploymentOptions.skipLoadingScreen = false;
}
The following is calling the above and loading the scene:
I tested the Shell mode multiple times and could not replicate the issuer you are having. Are you using the latest version of UFE? (2.6.0)
This is the script that comes with it (LoadVersusMode.cs):
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoadVersusMode : MonoBehaviour
{
public UFE3D.GlobalInfo globalConfigFile;
public UFE3D.CharacterInfo P1SelectedChar;
public UFE3D.CharacterInfo P2SelectedChar;
public int selectedStage;
public string UFESceneName;
public void LoadUFEScene()
{
globalConfigFile.deploymentOptions.deploymentType = UFE3D.DeploymentType.VersusMode;
globalConfigFile.deploymentOptions.activeCharacters[0] = P1SelectedChar;
globalConfigFile.deploymentOptions.activeCharacters[1] = P2SelectedChar;
globalConfigFile.deploymentOptions.AIControlled[0] = false;
globalConfigFile.deploymentOptions.AIControlled[1] = true;
globalConfigFile.selectedStage = globalConfigFile.stages[selectedStage];
SceneManager.LoadScene(UFESceneName);
}
}
Maybe you have a script that is connecting to UFE and that script is not being destroyed, causing UFE to linger in the memory. Are you using event listeners? Try removing them before destroying the scene containing UFE.
How to make character fall down at life 0 when player1 attacks with power and player2 has reaction animation to be playing. If player 1 attacks with punches then player2 fall down when life is 0 but when player1 uses power to attack at final move then player 2 has static animation move playing instead of UFE reactions. So I want player2 fall down when player1 uses power move and player2 plays reaction animation then fall down only life is 0.
Iβm currently working on a VR boxing game project and could use some advice.
Iβm looking to integrate the Universal Fighting Engine (UFE) for its AI features with PuppetMaster to achieve more realistic physics-based animation during character interactions.
Iβm wondering if anyone has experience integrating UFE and PuppetMaster simultaneously in a Unity project.
If anyone has tackled something similar or has tips on how to go about this, Iβd greatly appreciate your insights! Any guidance, best practices, or pointers would be awesome.
Thanks a bunch in advance for any help you can provide!
I donβt think this is related to memory usage, but rather animation root motion. The characters seem to be using both animation motion and UFE physics when jumping or performing moves. Here, check out this post:
Iβm unable to reproduce this issue. What license are you using (Lite, Basic, Standard, Pro, Source)?
And have you changed or did anything to the project that could have potentially caused the issue?
Hello,
I have tried to sign up for the website but I havenβt gotten the activation link and it has been several days. I tried signing up again and got nothing. I checked my junk/spam folder and got nothing. I emailed the webmaster and still nothing.
The problem that I am having is that I cannot get the character to rotate 90 degrees when setting up the hitboxes. So instead of using the hitbox transform boxes in the character window to rotate him, instead I used the rotation from the inspector window. However when I go to add a new hitbox, the hitboxes are not showing up. I have a video here. I also checked the gizmos to make sure that it is properly loaded. Please advise.
Backup Your Project
Before installing the new version, backup your project files to avoid accidental data loss.
Export Stances (if applicable)
If you have your moves assigned under "Move Editor -> Move Sets -> Stances (Preloaded)", click on βExport Stanceβ.
This will create a new move set file that can be converted to UFE 2.7.0βs new data model.
Replace the Files in Your Project
Go to "<Project Folder>\Assets\UFE\" and delete all files in this folder before adding the new package files.
Important: If you have custom files inside this folder, move them to a safe location outside your project folder before proceeding.
Update UFE in Your Project:
When reopening your project, you should see an alert prompting you to update to UFE 2.7.0. Click βProceed with Upgradeβ.
Didnβt see the alert? Right-click any global file in the project and select UFE -> Apply 2.7.0 Update.