Code Change Requests
Posted: Fri Apr 05, 2019 2:20 pm
Hey Tony,
I have made a couple code changes on my end that I have to reapply every time I update Dialogue System, which is quite irritating to do. I hope you think they are beneficial changes though, and request for you to add them, or some equivalent, into the core product, which would alleviate this for me and hopefully improve the product as well!
1. Sequencer Fade command
Problem: Depending on the speed of fade and perhaps the client's machine, sometimes we noticed that fading out would not go COMPLETELY BLACK. I'm talking the most slight thing, maybe alpha 254 as opposed to 255.
My solution: Change the sequencer command's OnDestroy method to set the alpha to a hard 0 or 1, like so:
2. Proximity Selector
Problem: If I despawn a GameObject or set it to inactive in the scene hierarchy mid-cutscene,, the Proximity Selector's "usablesInRange" list still counts these as valid usables, which caused a few issues for us.
My solution: Clean up the usablesInRange list on CheckTriggerExit (one actual line added, rest are comments):
Would greatly appreciate these, or again something like these if you have a better alternative in mind, to be added in! Appreciate all the work you've done and continued to do for us.
I have made a couple code changes on my end that I have to reapply every time I update Dialogue System, which is quite irritating to do. I hope you think they are beneficial changes though, and request for you to add them, or some equivalent, into the core product, which would alleviate this for me and hopefully improve the product as well!
1. Sequencer Fade command
Problem: Depending on the speed of fade and perhaps the client's machine, sometimes we noticed that fading out would not go COMPLETELY BLACK. I'm talking the most slight thing, maybe alpha 254 as opposed to 255.
My solution: Change the sequencer command's OnDestroy method to set the alpha to a hard 0 or 1, like so:
Code: Select all
public void OnDestroy()
{
if (faderCanvas != null) faderCanvas.gameObject.SetActive(stay);
if (faderImage != null)
{
float alpha = fadeIn ? 0.0f : 1.0f;
faderImage.color = new Color(color.r, color.g, color.b, alpha);
faderImage.gameObject.SetActive(stay);
}
}
Problem: If I despawn a GameObject or set it to inactive in the scene hierarchy mid-cutscene,, the Proximity Selector's "usablesInRange" list still counts these as valid usables, which caused a few issues for us.
My solution: Clean up the usablesInRange list on CheckTriggerExit (one actual line added, rest are comments):
Code: Select all
protected virtual void CheckTriggerExit(GameObject other)
{
Usable usable = other.GetComponent<Usable>();
if (usable != null && usable.enabled)
{
if (usablesInRange.Contains(usable)) usablesInRange.Remove(usable);
if (currentUsable == usable)
{
OnDeselectedUsableObject(usable);
toldListenersHaveUsable = false;
Usable newUsable = null;
//remove all that are null / inactive
usablesInRange.RemoveAll(usa => usa == null || !usa.gameObject.activeInHierarchy);
//NEW LINE HERE ^^^^
if (usablesInRange.Count > 0)
{
newUsable = usablesInRange[0];
OnSelectedUsableObject(newUsable);
toldListenersHaveUsable = true;
}
SetCurrentUsable(newUsable);
}
}
}