Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Gizmos not showing up

Discussion in 'Scripting' started by Hiktses, Jul 11, 2020.

  1. Hiktses

    Hiktses

    Joined:
    May 30, 2020
    Posts:
    19
    Code (CSharp):
    1.        void OnDrawGizmosSelected()
    2.         {
    3.  
    4.             Gizmos.color = Color.red;
    5.             Gizmos.DrawWireSphere(attackPos.position, attackRange);
    6.  
    7.  
    8.  
    9.         }
    Gizmos not showing up.What is the problem with this code?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,971
    Start by checking the data: use Debug.Log() to print out the values in the arguments you are supplying to DrawWireSphere. This has the side benefit of telling you if this code is even being called or not!
     
  3. Hiktses

    Hiktses

    Joined:
    May 30, 2020
    Posts:
    19
    They are all ok,but I noticed that I am having a error that is not even stopping the game.



    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.Graphs.Edge.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Edge.cs:114)
    UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List`1[T] inEdges, System.Collections.Generic.List`1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:387)
    UnityEditor.Graphs.Graph.WakeUpEdges (System.Boolean clearSlotEdges) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:286)


    I couldn't understand what is the problem.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,971
    Hiktses likes this.