zoukankan      html  css  js  c++  java
  • unity3d 自定义,改变鼠标样式,光标样式

    unity3d  改变鼠标,光标样式 - 重庆unity3d - unity3d工作室

     

    把这个脚本附在摄像机上,只要在my cursor付上鼠标的图片,my click cursor附上鼠标点击的图片就行了

    unity3d  改变鼠标,光标样式 - 重庆unity3d - unity3d工作室

     

    #pragma strict

    var myCursor : Texture2D;

    var myClickCursor : Texture2D;

    var cursorWidth : float;

    var cursorHeight : float;

    private var isClicked : boolean = false;

    function Start () {

    Screen.showCursor = false;

    }

    function Update () {

    if (Input.GetMouseButton(0)) 

    isClicked = true;

    else

    isClicked = false;

    }

    function OnGUI () {

    var mousePos = Input.mousePosition;

    GUI.depth = 0.2f;

    if (isClicked)

    GUI.DrawTexture(Rect(mousePos.x - cursorWidth / 2, Screen.height - mousePos.y - cursorHeight / 2,

    cursorWidth, cursorHeight), myClickCursor);

    else

    GUI.DrawTexture(Rect(mousePos.x - cursorWidth / 2, Screen.height - mousePos.y - cursorHeight / 2,

    cursorWidth, cursorHeight), myCursor);

    }

  • 相关阅读:
    jsp登录显示
    flask 分页
    module pip has no attribute main
    html active属性
    Centos7配置
    python爬虫笔记----4.Selenium库(自动化库)
    python爬虫笔记
    python报错记录
    mybatis逆向文件
    python简单验证码
  • 原文地址:https://www.cnblogs.com/FLWL/p/3723485.html
Copyright © 2011-2022 走看看