Мне нужно добавить в игру курсор мышки с определенным курсором вот выдержка из справки
MouseCursor Enumeration
Custom mouse cursor shapes used with EditorGUIUtility.AddcursorRect.
Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.
Заходим по ссылке из справки видим
EditorGUIUtility.AddCursorRect
static function AddCursorRect (position : Rect, mouse : MouseCursor) : void
Parameters
position the rectangle the control should be shown within
mouse the mouse cursor to use
Description
Add a custom mouse pointer to a control
function OnGUI()
{
// show the "Link" cursor when the mouse is howering over this rectangle.
EditorGUIUtility.AddCursorRect (Rect(10,10,100,100), MouseCursor.Link);
}
Все вроде разжевано все понятно да вот только ошибку выдает((
Мой скрипт
Синтаксис:
Используется csharp
using UnityEngine;
using System.Collections;
using UnityEditor;
public class NewBehaviourScript : MonoBehaviour
{
public Texture2D linc;
void OnGUI()
{
EditorGUIUtility.AddCursorRect(Rect(10, 10, 100, 100), linc);
}
}
using System.Collections;
using UnityEditor;
public class NewBehaviourScript : MonoBehaviour
{
public Texture2D linc;
void OnGUI()
{
EditorGUIUtility.AddCursorRect(Rect(10, 10, 100, 100), linc);
}
}
Ошибки гласят
Assets/Scripts/Mous.cs(11,48): error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected
Assets/Scripts/Mous.cs(11,34): error CS1502: The best overloaded method match for `UnityEditor.EditorGUIUtility.AddCursorRect(UnityEngine.Rect, UnityEditor.MouseCursor)' has some invalid arguments
Assets/Scripts/Mous.cs(11,34): error CS1503: Argument `#1' cannot convert `object' expression to type `UnityEngine.Rect'
Пытался разобраться сам, но не могу понять, что ему не нравится. Грешу на
Синтаксис:
Используется csharp
public Texture2D linc;
Подскажите пожалуйста.
Заранее спасибо