javascript - Unity3D报警告"Implicit downcast"?
怪我咯
怪我咯 2017-04-11 11:39:31
0
0
426

在做unity的入门练习

LevelScript.js

#pragma strict

var experience : int;
    
function Level() : int
{
    return experience / 750; 
}

LevelScriptEditor.js

#pragma strict

@CustomEditor (LevelScript)
class LevelScriptEditor extends Editor 
{
    function OnInspectorGUI()
    {   
        var myLevelScript : LevelScript = target;
        
        myLevelScript.experience = EditorGUILayout.IntField("Experience", myLevelScript.experience);
        EditorGUILayout.LabelField("Level", myLevelScript.Level().ToString());
    }
}

(视频用的是c#,不过我比较熟悉javscript,就用了javascript的格式)

虽然最后程序成功了,但是unity报了警告有点在意。有人知道是什么意思么?

Assets/Editor/LevelScriptEditor.js(8,42): BCW0028: WARNING: Implicit downcast from 'UnityEngine.Object' to 'LevelScript'.

怪我咯
怪我咯

走同样的路,发现不同的人生

모든 응답(0)
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!