Hi, I have a situation where I want to attach the inventory menu (worldspace) to the left controller in VR. During testing I setup the menu to be "Unity In-scene" and parented the menu to the [CameraRig], which worked perfectly in the test scene. But, now that I have transfered the contents to the main project, with real scenes, I have noticed some scenes initialize the inventory but others don't, even if the player is manually placed in the scene (I can tell the inventory is not initializing because when it loads properly AC hides the empty slots, but when it doesn't, I get the placeholder images I put in the slots, and of course, it doesn't work).
Except for the size, I can't really see anything else different between the scenes, and I know the controllers have a small delay in loading cause SteamVR needs to check if the physical controllers are connected. Still, I tried to unparent the inventory from the player and put it directly in one of the scenes (with the issue) and same thing, only placeholder images appear in the slots.
So, how would I go about initializing an inventory menu manually through scripting? I mean, connecting it to the UGUI and starting it up, to me it just's seems like the timing between AC loading and the UI loading is off. So it would probably be best if I cal the code manually when it' safe to do so.
Comments
We should assume that the Menu itself (so far as AC is aware of it) is OK in all scenes. To sync an AC's Menu to its Unity UI prefab manually, call LoadUnityUI. So, e.g.:
AC.PlayerMenus.GetMenuWithName ("MyMenu").LoadUnityUI ();
There's more to it behind the scenes though, but AC handles all of this automatically within PlayerMenus' RebuildMenus function, which should probably be the first thing to try running manually:
AC.KickStarter.playerMenus.RebuildMenus ();
There must still be some key difference between the scenes that work vs those that don't, but it sounds like it could be due to a conflict with the other systems you have running. Try placing Debug.Log commands in the LoadUnityUI function to see exactly what's going on.