Deed not working after scene changed?

Announcements, support questions, and discussion for Love/Hate.
Post Reply
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

Deed not working after scene changed?

Post by ds2497 »

This might be a basic question, but I'm uncertain about what I might have overlooked. In Scene A, with multiple characters, everything works as expected when I perform a Deed, and the affinity of faction members changes accordingly. However, upon switching to Scene B, performing a Deed doesn't seem to have any effect; the affinity remains the same. Even when I return to Scene A, there is no change in reaction. Any suggestions on what I should do?
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Deed not working after scene changed?

Post by Tony Li »

Hi,

Are there any errors or warnings in the Console window?

Does the FactionManager survive scene changes?
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

Re: Deed not working after scene changed?

Post by ds2497 »

Hi Tony,

I fixed it! I needed to have the FactionMember game object activated by default in the scene.

For you information, this is what happened in my situation:

In my scene, there's a GameObject called 'GameplayManager' serving as FactionManager's parent. I've set it up using a singleton, and it activates all its children if it's the only instance. After examining the code, it seems that the variable 'members' in FactionManager has a zero length when committing after the scene loads(the length is 1 before loading the scene) if I have it disabled by default .

Image
Image
Image

Thanks for your help!
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Deed not working after scene changed?

Post by Tony Li »

Hi,

Thanks for your explanation. I'm glad you got it working. I think what's happening is that the FactionMember can't find the FactionManager since it's inactive, so it's unable to register itself with the FactionManager.
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

Re: Deed not working after scene changed?

Post by ds2497 »

It makes sense, thanks for sharing!
Post Reply