Page 1 of 1
Disable controls until after loaded game
Posted: Wed Dec 28, 2016 1:05 am
by supadupa64
Is there a way I can use DSU to disable my player controls until after I load a game? The controls get all messed up when I load a game some times. I tried asking Justin about it, but it just wasn't working out.
I thought I might be able to play a random conversation somehow at the start of a load and then check the box "deactivate during conversation" in the "Dialogue System Third Person Controller Bridge" script, but I feel like there's a better way to get at it.
Re: Disable controls until after loaded game
Posted: Wed Dec 28, 2016 8:34 am
by Tony Li
The script methods
DialogueSystemThirdPersonControllerBridge.DisableTpcControl() and
EnableTpcControl() will disable and re-enable TPC controls. You could try writing a short script, or use the SendMessage() sequencer command like:
Code: Select all
SendMessage(DisableTpcControl,,Player)
But, before doing that, let's see if we can figure out why the controls are getting messed up in the first place. Can you identify the conditions that cause the controls to get messed up? Is it on a specific scene?
Re: Disable controls until after loaded game
Posted: Wed Dec 28, 2016 2:35 pm
by supadupa64
Here's exactly what's happening.
I load a game. Occasionally the controls gets messed up after the load. It seems random, but only happen during a load. When it does happen I get about 10 fps, my controls switch from combat mode to adventure mode, my health bar disappears for some reason and using wasd, the w key sends the player forward but the camera doesn't follow the player correctly.
If I reload the same saved game 3 or 4 times, that most of the time fixes it.
Re: Disable controls until after loaded game
Posted: Wed Dec 28, 2016 4:07 pm
by Tony Li
Does it happen in the editor? Or only in builds?
If it happens in the editor, are there any errors or warnings in the Console window? If so, please reproduce the issue and email the editor.log file to tony (at) pixelcrushers.com.
If it only happens in builds, please reproduce the issue and email me the _Data/output_log.txt file (if Windows).
Re: Disable controls until after loaded game
Posted: Wed Dec 28, 2016 4:18 pm
by supadupa64
It happens in the editor and build.
I dont remember seeing any errors when it happened. I'll have to check it again. Although I do have 2 large lag spikes during the load. One lag spike bottleneck when it sends the player to the original start, and one also when it loads the game.
Re: Disable controls until after loaded game
Posted: Wed Dec 28, 2016 8:50 pm
by Tony Li
Some lag spikes are hard to avoid. Sometimes the best thing you can do it to hide it with a fade-in screen or something like that. Two major sources of lag are when Unity loads large textures and models in the new scene, and when all the scripts run their Awake(), Start(), and OnEnable() methods. Most scripts run fast, but sometimes they have to do a lot of work. The profiler can usually give you an idea of what's causing the lag.
If you reproduce the issue and get anything out of the ordinary in the log (warnings, strange non-error messages, etc.), please send it to me.