I've created a hidden skill and am adding skill-based interactions to it. Before I gate them based on skill level, I want to just add and test them in the game first but keep running into the problem where the game hangs on world loading and this error:
<ExceptionData>simulating object is null unable to obtain an interaction object A null value was found where an object instance was required. #0: 0x00043 callvirt in Sims3.Gameplay.Olomaya.Sims3.Gameplay.Olomaya.ReligionSocials:AddInteractionsSims (Sims3.Gameplay.Actors.Sim) ([28BB6800] ) #1: 0x00016 call in Sims3.Gameplay.Olomaya.Sims3.Gameplay.Olomaya.ReligionSocials:OnWorldLoadFinished (object,System.EventArgs) ([27A988A0] [281DECA8] ) #2: 0x00000 in System.System.EventHandler:Invoke (object,System.EventArgs) (29649050 [27A988A0] [281DECA8] ) #3: 0x00013 callvirt in Sims3.SimIFace.Sims3.SimIFace.World:OnWorldLoadFinished () () </ExceptionData>
This is what I have in the script for the two issue areas highlighted above:
Hey @olomaya I know it's been a little while, so maybe hopefully you've already fixed the issue!
If not though, I'm not totally sure what the issue is. This section of code looks alright to me, and if it compiled fine, that does make it a bit less obvious what the problem is, but it might be worth either seeing the rest of your code ie the interactions, or uploading the package/solution here for someone to have a closer look.
A couple things though, that I don't think would cause the error, but may cause issues/can just be cleaned up:
Line 10 (adding the event listener), is currently in the for loop, so will happen for every sim in the world. This isn't necessary and it can just be done once, in the OnWorldLoadFinished method, so you could put that line before looping through all the sims in the world.
In the loop lines 21-27, if any one of those interactions are there, none of them will be added. This might work fine, but I don't know if there could be a case where some of the interactions aren't attached to the sim, but some are, and in that case you probably want to add the ones that aren't. So you would then need to do it either by looping through the interactions multiple times, each time checking for one of your custom ones and adding it if not there, or maybe by removing your interactions and then adding them back on might work.
Anyway, hopefully someone can actually help with the error you're getting :p