#2
5th Sep 2021 at 8:15 PM
Last edited by zoe22 : 7th Sep 2021 at
3:52 PM.
Posts: 562
Thanks: 3567 in 11 Posts
18 Achievements
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