2016-08-06 8 views
-3

私には2つの警告があります。それは私がゲームを実行することはできませんが、私はどのように私は警告を修正することはできません?スクリプトで2つの警告を修正するにはどうすればよいですか?警告は修正する必要がありますか?

最初の警告は、次のとおりです。

資産/マイスクリプト/ Ai_Scripts /エディタ/ Editor.cs(56,26):警告CS0618:UnityEditor.EditorGUIUtility.LookLikeControls()' is obsolete: LookLikeControlsとLookLikeInspectorモードが推奨されていません。 EditorGUIUtility.labelWidthとEditorGUIUtility.fieldWidthを使用して、ラベルとフィールドの幅を制御します。 '

行は次のようになります。

EditorGUIUtility.LookLikeControls(); 

私はラインを変更する必要がありますか? EditorGUIUtility.labelWidthとEditorGUIUtility.fieldWidthを使用するのはどういう意味ですか?どのように私は両方を使用するのですか?

2番目のエラーは、スクリプト内の別の部分の最初のエラーと全く同じです。この方法では

警告:LookLikeControls()が廃止されましたので

//called whenever the inspector gui gets rendered 
    public override void OnInspectorGUI() 
    { 
     //this pulls the relative variables from unity runtime and stores them in the object 
     //always call this first 
     m_Object.Update(); 

     //show default iMove.cs public variables in inspector 
     DrawDefaultInspector(); 

     //get Path Manager component by calling method GetWaypointArray() 
     var path = GetPathTransform(); 

     EditorGUILayout.Space(); 
     //make the default styles used by EditorGUI look like controls 
     EditorGUIUtility.LookLikeControls(); 
     //display custom float input field to change value of variable "sizeToAdd" 
     EditorGUILayout.PropertyField(m_Size); 

     //draw bold delay settings label 
     GUILayout.Label("Delay Settings:", EditorStyles.boldLabel); 

     //check whether a Path Manager component is set, if not display a label 
     if (path == null) 
     { 
      GUILayout.Label("No path set."); 

      //get StopAtPoint array count from serialized property and resize it to zero 
      //(in case of previously defined delay settings, clear old data) 
      m_Object.FindProperty(spArraySize).intValue = 0; 
     } 
     //path is set and boolean for displaying delay settings is true 
     //(button below was clicked) 
     else if (showDelaySetup) 
     { 
      //get StopAtPoint array reference by calling method GetStopPointArray() 
      var stopPoints = GetStopPointArray(); 

      EditorGUILayout.BeginHorizontal(); 
      //begin a scrolling view inside GUI, pass in Vector2 scroll position 
      scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Height(105)); 

      //loop through waypoint array 
      for (int i = 0; i < path.waypoints.Length; i++) 
      { 
       GUILayout.BeginHorizontal(); 
       //draw label with waypoint index, 
       //increased by one (so it does not start at zero) 
       GUILayout.Label((i + 1) + ".", GUILayout.Width(20)); 
       //create a float field for every waypoint delay slot 
       var result = EditorGUILayout.FloatField(stopPoints[i], GUILayout.Width(50)); 

       //if the float field has changed, set waypoint delay to new input 
       //(within serialized StopAtPoint array property) 
       if (GUI.changed) 
        SetPointDelay(i, result); 

       GUILayout.EndHorizontal(); 
      } 
      //ends the scrollview defined above 
      EditorGUILayout.EndScrollView(); 

      EditorGUILayout.BeginVertical(); 

      //draw button for hiding of delay settings 
      if (GUILayout.Button("Hide Delay Settings")) 
      { 
       showDelaySetup = false; 
      } 

      //draw button to set all delay value slots to the value specified in "delayAll" 
      if (GUILayout.Button("Set All:")) 
      { 
       //loop through all delay slots, call SetPointDelay() and pass in "delayAll" 
       for (int i = 0; i < stopPoints.Length; i++) 
        SetPointDelay(i, delayAll); 
      } 

      //create a float field for being able to change variable delayAll 
      delayAll = EditorGUILayout.FloatField(delayAll, GUILayout.Width(50)); 

      EditorGUILayout.EndVertical(); 

      EditorGUILayout.EndHorizontal(); 
     } 
     else 
     { 

      if (GUILayout.Button("Show Delay Settings")) 
      { 
       showDelaySetup = true; 
      } 
     } 


     m_Object.ApplyModifiedProperties(); 
    } 
+1

警告をさらに表示し、警告が表示されているメソッドを表示してください。 –

+1

行をコメントアウトし、カスタムエディタの違いを確認してください。それがあなたに大丈夫だと思われる場合は、ラインを完全に取り外してください。そうでなければ、 'labelWidth'と' fieldWidth'をあなたの好みに合わせて手動で調整してください。 – EvilTak

答えて

0

あなたは警告を取得しています。代わりにEditorGUIUtility.labelWidthEditorGUIUtility.fieldWidthを使用して、ラベルとフィールドの幅を制御してください。

関連する問題