Forum rules - please read before posting.

Post-processing on AC menu?

edited June 2020 in Technical Q&A

Initially, I only had one static speech menu that displayed subtitles at the bottom of the screen. I wanted to keep it that way, but I also wanted a small speech bubble icon (without any text) to be displayed above the character whose line was being spoken, just so it was clear who it was. I did this by creating another menu with the appear type "when speech plays" and position "above speaking character". I added one graphic element to it, and set my speech bubble as the texture. This worked perfectly.

The one problem I found was that I use the Amplify Color asset to apply dynamic post-processing effects and simulate a day-night cycle (it affects sprites selectively depending on the layer they are assigned to). The issue is that if I draw my speech bubble to look good during the day, at night it looks WAY too bright against the dark background, and vice-versa - so I want to find a way for the post-processing effect to be applied to that one menu as well.

Is this in any way possible? Any suggestions on how to achieve the effect? If changing the menu layer is not possible, is there a simple way to instantiate the sprite as a gameobject at the location the menu is drawn?

Comments

  • An "AC" menu, ie. one with its Source field set to Adventure Creator, is drawn using Unity's OnGUI system. IIRC, this is drawn last in the render sequence - even after post-processing.

    Switching the Menu to rely on Unity UI, and then playing with the Canvas's Render mode, should allow it to be included in the post-processing. I'd recommend testing with a simple Unity UI Image (not linked to AC) first, to see if this is possible.

    If necessary, you could indeed do it with a sprite above the speaking character by hooking into the OnStartSpeech custom event. Maybe rather than spawning a sprite, simply have the sprite in the scene, and attach a script that positions it above the speaker:

    using UnityEngine;
    using AC;
    
    public class SpeechBubble : MonoBehaviour
    {
    
        Char activeSpeaker;
    
        private void OnEnable ()
        {
            EventManager.OnStartSpeech += StartSpeech;
            EventManager.OnStopSpeech += StopSpeech;
        }
    
        private void OnDisable ()
        {
            EventManager.OnStartSpeech -= StartSpeech;
            EventManager.OnStopSpeech -= StopSpeech;
        }
    
        private void StartSpeech (AC.Char character, string lineText, int lineID)
        {
            if (character != null)
            {
                // Show
                activeSpeaker = character;
                GetComponent <SpriteRenderer>().enabled = true;
                transform.position = character.GetSpeechWorldPosition ();
            }
        }
    
        private void StopSpeech (AC.Char character)
        {
            if (character != null && character == activeSpeaker)
            {
                // Hide
                GetComponent <SpriteRenderer>().enabled = false;
            }
        }
    
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.