我想用C#在游戏中移动文本,但我不知道如何掌握实际文本,也不知道如何移动它的位置。
如何实现这一目标?
答案 0 :(得分:1)
您是否尝试使用脚本移动文本的位置?你的文字是使用Unity的UI系统还是图像/精灵?
你可以这样做: 对于UI文本:
Text yourText = Gameobject.Find("the name of your text gameobject").GetComponent<Text>();
yourText.transform.position = new Vector3(posX,posY,posZ);//where posX Y Z is the position where you want to put your text.
如果您提到的文字是精灵/图像,您可以使用类似的方式:
Gameobject yourText = Gameobject.Find("the name of your text gameobject").GetComponent<GameObject>();
yourText.transform.position = new Vector3(posX,posY,posZ);//where posX Y Z is the position where you want to put your text.
希望这有用......
答案 1 :(得分:0)