Issues with Changing UI at Runtime
Posted: Sat Apr 24, 2021 9:31 am
Hi, I'm having some challenges getting a UI change mid-conversation working properly and was wondering if anyone may have encountered this before or could help.
I know there is another thread on this and I've modeled my code based on that. Here is the Start() code for my ChangeUI Seqeuncer Command:
The above code works, but there is some weirdness around the camera I cannot figure out. The 'SceneCamMain' is set as the main camera object in the Dialogue Manager GameObject but when i do a UI change and stop and restart the conversation, it causes the dialogue manager to create a clone of my SceneCamMain Object. To prevent that, I have to assign the cam to the sequencer camera and alterateCameraObject as shown above. This works but it also causes the camera location to change for some reason and I have to reset the location in sequence code.
The main problem with this is that for like a microsecond, the player can see the camera location adjusting before it goes back to the right spot. It's not terrible, but a bit disruptive and not super smooth. If there is a way I can either force the camera to stay where it is between UI changes or change the UI without needing to stop and restart the conversation, that would be super helpful.
Thanks! This is a fantastic product and is really helping cut down on the complexity of existing code I had.
I know there is another thread on this and I've modeled my code based on that. Here is the Start() code for my ChangeUI Seqeuncer Command:
Code: Select all
// Get the values of the parameters:
uiEntry = GetParameter(1);
convoID = GetParameterAsInt(0);
string title = DialogueManager.LastConversationStarted;
DialogueManager.StopConversation();
GameState.CutScene = true;
DialogueManager.UseDialogueUI(GameObject.Find(uiEntry));
GameObject cam = GlobalFunctions.FindObject(GameObject.Find("SceneCamHolder"), "SceneCamMain");
if (cam == null)
cam = GameObject.Find("SceneCamMain");
DialogueManager.DisplaySettings.cameraSettings.sequencerCamera = cam.GetComponent<Camera>();
DialogueManager.DisplaySettings.cameraSettings.alternateCameraObject = cam;
Debug.Log("Set Camera");
DialogueManager.StartConversation(title, DialogueManager.CurrentActor, DialogueManager.CurrentConversant, convoID);
Stop();
The main problem with this is that for like a microsecond, the player can see the camera location adjusting before it goes back to the right spot. It's not terrible, but a bit disruptive and not super smooth. If there is a way I can either force the camera to stay where it is between UI changes or change the UI without needing to stop and restart the conversation, that would be super helpful.
Thanks! This is a fantastic product and is really helping cut down on the complexity of existing code I had.