Page 1 of 1
Deed not working after scene changed?
Posted: Wed Dec 27, 2023 11:14 am
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?
Re: Deed not working after scene changed?
Posted: Wed Dec 27, 2023 12:10 pm
by Tony Li
Hi,
Are there any errors or warnings in the Console window?
Does the FactionManager survive scene changes?
Re: Deed not working after scene changed?
Posted: Thu Dec 28, 2023 2:17 pm
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 .
Thanks for your help!
Re: Deed not working after scene changed?
Posted: Thu Dec 28, 2023 4:00 pm
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.
Re: Deed not working after scene changed?
Posted: Thu Dec 28, 2023 9:44 pm
by ds2497
It makes sense, thanks for sharing!