Stop Text object moving with player
Hello,
So I have a bit of text displaying the number of power-ups a player has remaining.
// Display number of available speed boosts
speedBoostAvailableText.text = "BOOSTS: " + speedBoostAvailable.ToString();
if (Input.GetKeyDown(KeyCode.Q))
{
if (lockSpeed == false)
{
if(speedBoostAvailable>0)
{
// Double our movespeed
moveSpeed = moveSpeed * 2;
// Remove a speedBoost
speedBoostAvailable -= 1;
// Lock our speed so our player can't spam the speedboost
lockSpeed = true;
}
else
{
print("No boosts left");
}
}
else
{
print("Boost is on cooldown.");
}
// Reset movespeed buff after 3 seconds
Invoke("ResetSpeed", 3.0f);
}
When I move my player, the boost text is moving with the player as the BoostText needs the Player script attached to it.
How can I force the text to stay static? I feel like I am missing something here, any help would be much appreciated!
Answer by cwcarlos123654 · Apr 07, 2018 at 06:56 PM
Why do you have text object? U should create>Ui>Text And it wont go anywere
Answer by EddieEldridge · Apr 07, 2018 at 07:45 PM
I am using UI Text (not the legacy version) but because my Player script is attached to the UI>Text (as it requires variable from this script), the transformations being done by this script are affecting both the player and the text
Is there any way to force the text to be static or to not move?
Your answer
Follow this Question
Related Questions
TextUI text changes size if resolution changes 1 Answer
TextMeshPro Set Alpha Color 0 Answers
How to draw text in a non-rectangular area 0 Answers
Using Japanese in my game 1 Answer