Forum rules - please read before posting.

How to set player subitles to not move with anmation?

Hi Chris,

So I have my player subtitles prefab set to above speaking player, and my player is spine animated, and in. idle state my player gently moves and unfortunately the subtitles also thus move with the spine animation. Is there anyway to keep them still.

And second, how do I have the subtitles set to the left above the player rather than centered? See screenshots please:

https://www.dropbox.com/scl/fo/pkkhkie6qhpni7owtukvc/h?rlkey=gzqseknyg82rb46zlnfmadct1&dl=0

Thanks!

Comments

  • You can assign a "Speech placement child" Transform in the Player's Inspector, which will override the placement of "Above Speaking Player" menus.

  • Thank you. And how would I change the placement position depending on which side of the screen the player is on? Ultimately I’d like to flip the image and for it to be on the right of in the left hand side of the screen and vice versa
  • I have created a global bool variable for PlayerLeft and added an animation component to the speech placement for speech left and speech right, I just need to somehow recognise when the player is in left or right of screen to turn the variable on or off. Can you help please? (if this is the best way to do it!)

  • This script will set a Global Bool to True when the Player is on the right of the screen, and vice-versa:

    using UnityEngine;
    using AC;
    
    public class PlayerScreenSide : MonoBehaviour
    {
    
        public int variableID;
        GVar variable;
    
        void Update ()
        {
            if (variable == null)
            {
                variable = GlobalVariables.GetVariable (variableID);
            }
            if (variable != null && KickStarter.player)
            {
                Vector2 playerScreenPosition = Camera.main.WorldToViewportPoint (KickStarter.player.transform.position);
                variable.BooleanValue = playerScreenPosition.x > 0.5f;
            }
        }
    
    }
    
  • Thanks! So I have just downloaded the speech bubble download, but would love to implement the arrow position to be either far right or far left depending on which side of the screen the player is on - how would I do this?

    See screenshots

    https://www.dropbox.com/scl/fo/c88tk3q9k0bncszr114nt/h?rlkey=dzijluar08n9861lsccs3adpk&dl=0

  • two more things please, how do I get the arrow more in the middle of the bubble, and second how does the above script need to be tweaked so it affects NPC's too please?

  • The Speech Bubble menu self controls its position and that of the arrow. I will update it with the ability to configure the arrow's position and direction.

    how does the above script need to be tweaked so it affects NPC's too please?

    You wouldn't rely on a variable, as you'd need a separate one for each NPC. Instead, you'd control the animation directly. Something like:

    using UnityEngine;
    using AC;
    
    public class CharacterScreenSide : MonoBehaviour
    {
    
        public AC.Char character;
        public Animator animator;
        public string boolParameter = "IsOnRight";
    
        void Update ()
        {
            Vector2 characterScreenPosition = Camera.main.WorldToViewportPoint (character.transform.position);
            bool isOnRight = characterScreenPosition.x > 0.5f;
            animator.SetBool (boolParameter, isOnRight);
        }
    
    }
    
  • edited January 17

    ok great, will you let me know when updated? And would I put this script as a gameobject in every scene or on the arrow? And how do I account for multiple NPC's in one scene as the script only accounts for one? What animator do I put in too? As in some scenes the NPC's use the same speech bubble UI

  • ok great, will you let me know when updated?

    It's updated. The arrow's position can be adjusted through its Inspector and through script.

    And would I put this script as a gameobject in every scene or on the arrow?

    The script is unrelated to the arrow / speech menu - it is for individual characters. As you earlier said, you are using an Animator attached to the Speech Placement child to control its position - this script will affect a bool parameter in that Animator based on which side of the screen the assigned character is on.

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.