I messed up the title… it should be “Scripts saving data between playmodes activations”
That title is about as accurate as I can make it since I don’t have a good idea of what is going on.
Image Descriptions:
The first image is the scene view. I intend to be able to click on boxes that appear in either the left or the right inventory and have an image of the object show up in a confirmation window in the center. While it looks like it is working, I had not clicked anything during that ‘run’ and what is currently showing up is the information from the last item I clicked the previous time. When the scene begins a script sets up all of the data and one instantiate call creates a single game object on the canvas, containing all three displays. Those three displays themselves are prefabs.
The second image is the hierarchy as it appears during the first image.
The third image is the hierarchy as it appears in the prefab editor of what I put on the background canvas, mostly to emphasize that almost all of these are prefabs attached to prefabs.
Intended behavior:
The user should be able to click on any of the red boxes in the right side group. The selection should be represented in the middle window.
Current behavior:
Clicking any of the red boxes (buttons) on the right registers the correct information (verified with print statements), and the data gets all the way to the system that updates the red box on the confirmation window, but the text nor image update. When the scene playmode is ended and re-started, the confirmation window will show the data of the last clicked on item from the right inventory.
Notes:
I have had problems with prefabs before, it would not be unusual if I was somehow referencing the original prefab while trying to change the visible version of it.
Whether I have clicked boxes on the right or not, this code:
public void OnPointerEnter(PointerEventData eventData){
if(_item == null) {Debug.Log("No item found"); return;}
}
evaluates to true and exits.
I can post the code, but its a bit spread across a few files. I didn’t want to make this original post absurdly long.