I have encountered an issue while trying to load my assets into an array using a function called LoadJSON(). This function utilizes THREE.ObjectLoader() to load JSON files. The problem arises when I attempt to access the members of the array immediately after calling LoadJSON(), as it returns undefined and causes my program to fail. After conducting some research, I discovered that the assets are being loaded asynchronously, which explains why they cannot be accessed right away (as they are still loading). To test this theory, I tried accessing the array's members after a short delay, which proved successful.
Now, my question is: Is there a way to ensure that the assets are fully loaded before proceeding with any other actions? Upon inspecting the THREE.ObjectLoader code, I could not find a direct solution to this problem (although it may be possible that I overlooked it). Implementing a time delay seems like an unreliable workaround.