Topic: Addressables

I was wondering if anyone has integrated Unity's Addressables system with UFE?

Im late in the development cycle and not sure how much work it would be, and if it would be worth it. I'd be interested to see if anyone tried it.

Share

Thumbs up Thumbs down

Re: Addressables

Hey Steviebops,

Unfortunately we are still in early development cycle yet we are in a great struggle for a week now to get our UFE project integrated with Unity's Addressables and it is leaving us with great pain everyday. If anyone has the answer I'd be really happy to hear it too...

Every time one problem is solved, another two occur - welcome to programming life.

Currently we are having problems after loading the fight, animator controller is broken and characters are stuck in the ground with their legs curled up their butt. Moving and fighting still works, but the model doesn't respond to any animations...

Update as I was typing - now characters are standing in T-Pose and their heads are spinning through their bodies.

Share

Thumbs up +1 Thumbs down

Re: Addressables

Im in the same place, Unity addressables are very tricky to use, even more so when you have UFE which already has its own method of loading everything from scenes to prefabs.

Share

Thumbs up Thumbs down

4 (edited by Misiek 2022-02-07 05:15:57)

Re: Addressables

Just an update, we eventually managed to get things working last friday. There was a lot of trial and error involved, and multiple devs working on that so I'm not sure if I'll include everything that's been done but hope some of this info will help you and perhaps others in the same struggle.

Also should probably mention that main gameplay we have doesn't go through the UFE menu, but straight into loading battle scene. Going through the actual menu works fine afaik, but someone else is working on that as a different game mode.

For our story, where player runs around with the main character and encounters opponents in open world, we have gone for separate scenes per different character (we have about 13 at the moment).

The main struggles we faced were obviously figuring out what should be made Addressable, and getting the Character Info to persist across to the next scene with UFE. Instead of trying to make it persist, it was easier to set up the separate scenes per character with required data already predefined, but then we struggled a lot with broken animations and Move Sets.

So in terms of Addressables:
- All Character Info's are one group of packed assets
- In the Character Info config, Move Set was previously Stance (preloaded). We had to change it to Stances (Resource). We simply exported the Stance (preloaded)'s of each character, and put them all in a Resources folder, then added the Resource Path as such:

UFE\Arcadia\MoveSets\Gorerilla Stance 1

Note that it goes from Resources folder onwards, and uses \ instead of /.

- All Move Scriptable Objects of a character are a group of packed assets, separate for each character, along with their fight scene.
- This fight scene holds a prefab of UFE Manager which is also set as its own group Addressable
- That prefab has a PredeterminedFight script with the Global Config, main character's Char Info, the opponent's Char Info and the Stage hard referenced:

public class PredeterminedFight : MonoBehaviour
    {
        public GlobalInfo config;

        public AssetReference player1;
        public AssetReference player2;

        private CharacterInfo p1;
        private CharacterInfo p2;
        

        public enum Stages
        {
            EdwardRoom,
            SerroRoom,
            TorakRoom,
            BrowlRoom,
            ElenorRoom,
            ShastaRoom,
            XebenachRoom
        }

        public Stages stage;

        IEnumerator StartFight()
        {
            var _p1 = Addressables.LoadAssetAsync<CharacterInfo>(player1);
            yield return _p1;
            p1 = _p1.Result;
            var _p2 = Addressables.LoadAssetAsync<CharacterInfo>(player2);
            yield return _p2;
            p2 = _p2.Result;
            
            UFE.gameMode = GameMode.VersusMode;
            UFE.SetPlayer1(p1);
            UFE.SetPlayer2(p2);
            //UFE.SetStage(config.stages[(int)stage]);
            UFE.SetStage(config.stages[0]); // TODO: REMOVE ONCE ALL STAGES HAVE BEEN ADDED
            UFE.SetCPU(1, false);
            UFE.SetCPU(2, true);
            UFE.StartLoadingBattleScreen();
        }

        void Start()
        {
            StartCoroutine(StartFight());
        }
    }

I think that covers most of the things we've done to make it work. Hope that helps!

Share

Thumbs up +1 Thumbs down

Re: Addressables

I've got another update for this stuff. So the above made things work, but after leaving a fight, and trying to commence another one, we were getting an error from DefaultBattleGUI about a missing Image (even though it was there apparently), and after such error, there always follows up with ControlsScript trying to add a "Key: Forward" that has already been added.

I spent half of yesterday debugging it and I dug a massive code hole around it trying to figure out what to do with it. Then I gave up cause it was getting late. This morning one of my colleagues already fixed it with couple lines of code by the time I got to my PC big_smile

The code changes are as follows:

DefaultBattleGUI.cs, OnGameBegin line ~364 add if(!this) return;

    protected override void OnGameBegin (ControlsScript cPlayer1, ControlsScript cPlayer2, StageOptions stage){
        if (!this)
            return;
        
        base.OnGameBegin (cPlayer1, cPlayer2, stage);

ControlsScript.cs, Init line ~116, added if (inputHeldDown.ContainsKey(bp)) continue;

    public void Init() {
        foreach (ButtonPress bp in System.Enum.GetValues(typeof(ButtonPress)))
        {
            if (inputHeldDown.ContainsKey(bp)) continue;
            inputHeldDown.Add(bp, 0);
        }

Share

Thumbs up +1 Thumbs down