如何获取当前光标作为 Texture2D Unity C# [英] How to get current cursor as Texture2D Unity C#

查看:31
本文介绍了如何获取当前光标作为 Texture2D Unity C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我想获取当前光标,并将其作为 Unity 中的 Texture2D 获取.

I have a problem, I want to get the current cursor, and get it as a texture2D in Unity.

当我说当前光标时,我的意思是用户拥有的当前光标.例如,如果用户将他的光标更改为一只猫,我希望在 Unity 中拥有相同的猫光标.这就是为什么我不只是在线搜索默认光标的原因.

When I say current cursor, I mean the current cursor the user has got. For example, if the user changes his cursor to a cat, I want to have the same cat cursor in Unity. That is the reason why I don't just search online for the default cursor.

我试图在谷歌中搜索这个,但我得到的只是这个,它是在 2009 年发布的,但代码不起作用(如果您想知道,它会说句柄不代表图标").

I have tried to search in google for this, but all I got is this , it was posted in 2009, and the code doesn't work(it says "Handle doesn't represent a ICON" if you were wondering).

推荐答案

谢谢你们,但我想通了,我发现了关于 this 并使用 SepehrM 答案将光标转换为位图,只需 使用这个将位图转换为texture2D,再次感谢:)

Thank you guys, but i figured it out,i found out about this and used SepehrM answer to convert the cursor to bitmap, and just used this to convert the bitmap to a texture2D, Thanks again :)

这篇关于如何获取当前光标作为 Texture2D Unity C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆