I’m trying to make a utility to take a screenshot while I’m editing a prefab so I can easily make icons of items with transparent backgrounds. Because there doesn’t seem to be a way to cause the scene view camera to render any light you attach to it, I’m finding myself forced to temporarily create a light inside the prefab itself if I don’t want the screenshot to appear unlit.
This works fine if I do it manually, but I want to script the process. The issue is that if I have a prefab open and call new GameObject(); then the new GameObject is created in the current scene, not the current prefab that I have open for editing.
Please note that this prefab doesn’t exist in the scene at all. I’ve opened the prefab directly by double clicking on it in the project folders, so I’m not sure why the call to create the new GameObject is ignoring the prefab I have open and putting it in the scene instead.