Rewired stops working

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Kamotachi
Posts: 51
Joined: Fri Nov 29, 2019 9:03 pm

Rewired stops working

Post by Kamotachi »

Hello!
I have been searching the forum and have not found the problem I'm having.

I'm using Rewired together with the dialog system. I have set the component “Input Device Manager” and “Input Device Manager Rewired”. Everything works perfectly.

The problem comes when I load a new scene. I use the “Proximity Selector” component in the player. As soon as there is a scene load I can no longer interact with the objects that have DialogueTrigger and “usable”. The UI appears, so I understand that the “Proximity Selector” detects them, but when I press the action button, it does not work.

I have tested and Rewired still works, but I think it creates a disconnect with Dialogue System when changing scenes.

To give some more context:
I have a GameManager, which is a singleton, this contains the DialogueManager (which is not destroyed) and a “Rewired Input Manager” which is also not destroyed, as it is part of the GameManager. In addition, I believe that something similar happens with the component “Dialogue Actor” that the player has, it is also in the singleton/GameManager and I believe that when making a scene change it is also lost.

I haven't seen anything similar on the forum, I bet I'm doing something wrong related to the singleton.
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Rewired stops working

Post by Tony Li »

Hi,

Is there a GameManager GameObject in the second scene, too?

Is the InputDeviceManagerRewired component on the GameManager GameObject or the Dialogue Manager GameObject? It should be on the Dialogue Manager so that it's on the same GameObject as the InputDeviceManager component.

If there's a GameManager in the second scene, is it possible that this GameManager is not destroying itself in Awake, and that it's allowing the components in its hierarchy to run their Start methods? If so, this could be a problem. The InputDeviceManagerRewired component assigns its delegate methods to InputDeviceManager in Start. If the second GameManager's InputDeviceManagerRewired component assigns its methods to the InputDeviceManager and then that InputDeviceManagerRewired component is destroyed, the InputDeviceManager won't be able to detect input.
Kamotachi
Posts: 51
Joined: Fri Nov 29, 2019 9:03 pm

Re: Rewired stops working

Post by Kamotachi »

I had to struggle a bit and stir up some code, but it's fixed now. That last one was a key clue! Thanks!

I have a habit of putting the Player inside the GameManager, so it never gets destroyed and I don't have to look for variables in loading levels.

However in doing so, there was some problem between the “Proximity Selector” and “Input Device Manager Rewired”. I would say that at some point they suffered a disconnection, although I think it was not destroying anything when loading a new scenario, so I have not finished understanding it.

In any case the solution has been to remove the Player (with its “Proximity Selector”) from the singleton/GameManager and put it manually in the scenarios as it is in the Demo available inside the asset.

Already solved, thank you!
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Rewired stops working

Post by Tony Li »

Awesome! I'm glad you got it working.
Post Reply