Object in scene but not visible

The intended response from the code below is to load a 3d object into a scene based on buttons clicked by the user. The first time an object is selected, it is pulled from a server, stored into a cache, and added to the scene. If a user selects a different 3d object, it will remove the 3d object currently in the scene and load the new object. If the user clicks the same object again, it will remove the object from the scene.

I’m currently having a strange bug where if I first click an object and it loads, and then I select a different object, it will remove the first object, put the 2nd object into the scene (which I verify is in the scene put printing scene to the console) but it isn’t visible. Also, if I load an object, then remove it, then try to load the same object to the screen, it isn’t rendered to the screen.

In all cases, when I look at the objects in the scene, it says that the object is there and is visible. After it doesnt show up on the 2nd load, when I click different objects, they load and are removed from the scene appropriately.

Note: I’m new to asking for help like this so unsure how much code to post. And since I’m really not sure where the issue is. No errors are thrown when executing the code, and as stated, when I print the scene to console, it states the object is in the scene, you just can’t see it

I’m beginner so please take caution with my message.

But are you rendering the scene again after you added the objects ?
Also, make sure your variables are different. You cannot set a variable to contain an objet and use the same variable to contain a second objet, even if the first one and the second one are the same.

Are you using groups to add your objects ?

Don’t hesitate to post your code, of important parts of it, to permit to experts to bring you the most efficient help they can. You can post your code by adding 4 space on the beginning of each lines of your code. This could be very usefull to help you !

Posting code makes sense if you want to discuss a small code snippet. The best thing you can do is to post a live example which makes it easy to start debugging and verifying your problem. If you can’t make a live example (for whatever reasons), try to share your entire code as a public github repository. The repo should ideally be self contained, so user can directly start the application after downloading.