[英]custom cursor not showing up
I'm pretty new to c# and unity, and I was trying to make a custom cursor by attaching this code to the cursor gameobject.我对 c# 和统一很陌生,我试图通过将此代码附加到 cursor 游戏对象来制作自定义 cursor。 In the inspector, I can see that the gameobject is clearly following the mouse, but the gameobject just disappears when I start the game.
在检查器中,我可以看到游戏对象明显跟随鼠标,但是当我开始游戏时,游戏对象就消失了。
void Start()
{
Cursor.visible = false;
}
void Update()
{
Vector3 cursorPosition = Input.mousePosition;
transform.position = cursorPosition;
}
You should use this function to set a new cursor Texture Cursor.SetCursor(Texture2D,CursorMode)
" if you want to do it at runtime. Also you can set the default cursor on menu Edit > Project Settings > Player > Default cursor You should use this function to set a new cursor Texture
Cursor.SetCursor(Texture2D,CursorMode)
" if you want to do it at runtime. Also you can set the default cursor on menu Edit > Project Settings > Player > Default cursor
Documentation of this Method 此方法的文档
Also you have to configure the Texture import to be a type cursor Texture, you can find the documentation of how set up a Texture cursor on this link:您还必须将纹理导入配置为类型 cursor 纹理,您可以在此链接上找到有关如何设置纹理 cursor 的文档:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.