Page 1 of 1
QM+UIS data sync works in editor but not on my phone
Posted: Thu Dec 02, 2021 1:28 pm
by bitmore
Hi,
I'm using QM 1.2.21+UCC 2.4.4+UIS 1.2.3, and the quest counters sync UIS item amount with Value Mode:
Data Sync. It works well in Unity editor, but if I build and run on my android phone, the counter does not sync with UIS item. The screenshots show the error that occured when the player pickup an UIS item.
Edit:
I just found the Release Note of QM 1.2.21, the last null reference exception in UISItemAmountQuestCondition seems like the issue I have. But I'm using QM 1.2.21 and this issue still.
- a.png (116.57 KiB) Viewed 932 times
- b.png (108.11 KiB) Viewed 932 times
Re: QM+UIS data sync works in editor but not on my phone
Posted: Thu Dec 02, 2021 1:33 pm
by Tony Li
Hi,
Your screenshots didn't come through. Would you please post them again?
Try playing in the editor from the first scene in build settings. Keep in mind that the Quest Machine GameObject survives scene changes and supplants any Quest Machine GameObjects in subsequently-loaded scenes. It may be that you've assigned a direct reference to something in the Quest Machine hierarchy and it's losing the reference when changing scenes.
Re: QM+UIS data sync works in editor but not on my phone
Posted: Thu Dec 02, 2021 1:44 pm
by bitmore
Tony Li wrote: ↑Thu Dec 02, 2021 1:33 pm
Hi,
Your screenshots didn't come through. Would you please post them again?
Try playing in the editor from the first scene in build settings. Keep in mind that the Quest Machine GameObject survives scene changes and supplants any Quest Machine GameObjects in subsequently-loaded scenes. It may be that you've assigned a direct reference to something in the Quest Machine hierarchy and it's losing the reference when changing scenes.
Thank you for replying so quickly. Everything works well in the editor. The issue only happens on the phone, and with no changing scenes, I test it in one scene. Also I double-checked the reference in the Quest Machine they all reference the children game objects.
I just found the Release Note of QM 1.2.21, the last null reference exception in UISItemAmountQuestCondition seems like the issue I have. But I'm using QM 1.2.21 and this issue still.
Re: QM+UIS data sync works in editor but not on my phone
Posted: Thu Dec 02, 2021 1:58 pm
by Tony Li
Hi,
Have you downloaded and imported the latest UIS integration for Quest Machine? Here's a download if you haven't already imported it:
OpsiveUIS_QuestMachine_Integration_2021-10-14.unitypackage
Re: QM+UIS data sync works in editor but not on my phone
Posted: Thu Dec 02, 2021 2:02 pm
by bitmore
Yes, I redownloaded the packages hours ago.
And I just downloaded the package you provided, the import window shows Nothing to import which means I already import this package.
I just check the UIS QM Demo, there is a UIS Saver on Player and a UIS Saver on Pixel Crusher Save System, do we need both of them at the same time?
Re: QM+UIS data sync works in editor but not on my phone
Posted: Thu Dec 02, 2021 2:35 pm
by Tony Li
Hi,
Are you specifying an inventory name in the UI Item Amount Quest Condition?
If not, does your scene have a GameObject tagged "Player" that has an inventory?
You can try this version of the package, which logs a warning if it doesn't find an inventory:
OpsiveUIS_QuestMachine_Integration_2021-12-02.unitypackage
If that doesn't help, the error is happening inside UIS's EventHandler class, which is a closed class. Would you please contact Opsive about the error? If you send them the Console window screenshot of the ArgumentNullException, they should be able to help. You can post on the Opsive forum or try messaging @Sangemdoko in the ultimate inventory system - #general channel on discord.
Re: QM+UIS data sync works in editor but not on my phone
Posted: Thu Dec 02, 2021 3:15 pm
by bitmore
Thanks, Tony. I appreciate your time.
It logs a warning that it doesn't find the inventory.
I leave the inventory name blank in the UI Item Amount condition, but my player is spawned by script after the scene was loaded, this could cause the Quest Machine can't find the player, right?
Is there any way I can set the player to Quest Machine after the player was spawned?
Re: QM+UIS data sync works in editor but not on my phone
Posted: Thu Dec 02, 2021 3:37 pm
by Tony Li
Hi,
Is your player tagged 'Player'? If so, then it should work, generally speaking.
If the quest condition is running at the very start of the scene, you can delay it. For example, if you're changing scenes using the Save System (e.g., Scene Portal component or SaveSystem.LoadScene() method), then set the Save System component's Frames To Wait Before Apply Data to 1 or more. This will make Quest Machine wait 1 or more frames to apply data to savers (including activating conditions). Otherwise, you can use a Timed Event. But it's better to get to the bottom of the issue first. It may just be as simple as making sure the player GameObject that has the Inventory component is tagged 'Player'.
Re: QM+UIS data sync works in editor but not on my phone
Posted: Fri Dec 03, 2021 1:17 am
by bitmore
Hi Tony,
After debugging in the
UISUtility script I found the problem:
The player is tagged 'Player'. And there is a collider in the player's children object also tagged 'Player'.
Code: Select all
subject = GameObject.FindGameObjectWithTag("Player");
In the editor this line finds the player object, on the phone it finds the
child game object.
Code: Select all
var inventory = subject.GetComponent<Inventory>() ?? subject.GetComponentInChildren<Inventory>();
While on the phone, this line can't get the Inventory that is in the parent.
I changed the collider's tag to something else and make sure there is only one 'Player' tag in the scene, now it works well.
Thanks for your help, Tony.
Re: QM+UIS data sync works in editor but not on my phone
Posted: Fri Dec 03, 2021 7:46 am
by Tony Li
Hi,
Happy to help. I'm glad you got it working. The next update to the UIS integration will check all GameObjects that are tagged 'Player' and use the one that has the Inventory component.