- Home /
Gizmo.DrawLine() not working on child class
I have a base class which implements the OnDrawGizmos function and in that function it takes the gameobjects position and the position of another passed in and draws a line between them. I have multiple classes which inherit from this class and only one child class actually gets the lines rendered in the editor. I set breakpoints and it is in fact calling the Gizmo.DrawLine() funtion with valid positions on all the children class objects, yet as I stated there is no line in the editor. I have no clue what could be happening here.
The child classes are completely empty at this point, they have no variables or anything to set them apart from each other. Also Gizmos.DrawIcon works for all the classes.
That sounds curious. Are these objects all at or around the world origin, position (0,0,0)
? I'm trying to think of things that might go wrong, and mixing up local/world coordinates is about all I've got, if you're sure that DrawLine
is getting called.
No they are anywhere from +200 to -200 on the z and x axis. Also Im using gameObject.transform.position for my positions which is world space position.
Thanks for replying, at least. I can't think of what else might be wrong, unfortunately. $$anonymous$$aybe somebody else will have an idea. If you can post any code that reproduces the issue, that might help.
Well I fiddled around with stuff and figured out that if I started with the original prefab for the class that worked and changed the class on it and saved it as a new prefab that still worked so I guess that's my solution for now. Still unsure of why this happened thought.
Your answer
Follow this Question
Related Questions
Choosing which camera draws gizmos 1 Answer
How do you detect clicks in scene view without losing object focus? 0 Answers
Is OnDrawGizmos called in build? 2 Answers
Pathfinding Only Working in Editor View 0 Answers
Equivalent of Awake() for Gizmos? 0 Answers