I am trying to load, at run time, a UI prefab and have that display on a canvas. I was following the directions found on this forum. I am able to get it to load and display, but it is not showing up correctly, as shown here:
Here's my code:
// load the prefab Object subView = Resources.Load($"prefabs/Tutorial-Info"); // find the attach point (see screen shot for child hierarchy) GameObject panel = SearchFor("Panel"); var subPanel = Instantiate(subView, new Vector3(0, 0, 0), Quaternion.identity) as GameObject; subPanel.transform.SetParent(panel.transform, false);
SearchFor is a function I wrote to find canvas objects by name. It is correctly returning "Panel" object. The code that function is here.)
I am not sure why the prefab instantiated at run time is not appearing where I want it to appear. What should I do?