The PictureController will expose a method SetFrame() that takes a frame game object as a parameter. It will delete the existing frame in the FramedImage and spawn (add) the selected one instead. Make the following additions to the PictureController.cs script.
At the top of the class, add a variable for the frame spawn:
File: PictureController.cs private Renderer imageRenderer;
Initialize this in Start(). We already have a reference to the framedImage, so it's safe to just find its child Image:
void Start() { ... Transform image = framedImage.Find("Image"); imageRenderer = image.gameObject.GetComponent<Renderer>();
Now we can write the public function SetFrame as follows:
public void SetFrame(GameObject frameGameObject) ...