Reputation: 673
I have a line renderer component on a prefab, and would like to be able to add positions to this line renderer in script.
I thought I would be able to simply append LineRenderer.positionCount
to add a point to the list, which the unity documentation appears to suggest. I've also seen this suggested when I've tried to search for a solution.
However, when I try this I get a compile error, saying that positionCount
doesn't exist:
'LineRenderer' does not contain a definition for 'positionCount' and no extension method 'positionCount' accepting a first argument of type 'LineRenderer' could be found (are you missing a using directive or an assembly reference?)
The same is true if I try to use LineRenderer.GetPositions()
or even if I try to just access LineRenderer.positions
directly, they don't appear to exist.
As you can see hear these properties and methods don't appear in Visual Studio when I try to access them. All that's visible when searching position
are SetPosition()
and SetPositions()
.
So what am I doing wrong here, and how do I access these properties?
Upvotes: 1
Views: 415
Reputation: 3231
The only thing I can see is you may be using an ancient version of Unity:
Before Unity 5.5, the only members of LineRenderer
containing "position" in their name are SetPosition
and SetPositions
, see the legacy doc of 5.4.
Although I would find it surprising, if you were to be on such a version, it would be in your best interest to upgrade asap as possible.
Upvotes: 4