How do you edit a shape during runtime?
Hi, I'm trying to edit the radius of a regular polygon during runtime (so it can become bigger and smaller as an animation) but the usual code for accessing a component variable of a game object in Unity isn't working because the script "Regular Polygon" isn't recognized, even though MS Visual Studio and the script for Regular Polygon clearly shows that "Radius" is a float variable of the Regular Polygon script.
What I have is "Circle AoE" being passed as a "Game Object" into a script, and then I try to edit that using the standard "Get Component" code but it refuses to link to the Regular Polygon script and gives the error message: 'GameObject' does not contain a definition for 'RegularPolygon' and no accessible extension method 'RegularPolygon' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?).
So how are shapes edited by scripts during runtime? Can this be done on shapes that are made in the Unity WYSIWYG editor by scripts, or do I need to make the object by script first before I can edit it during runtime (this would cause a whole new set of problems if I tried it).
if you got the error
it means somewhere you typed myGameObject.RegularPolygon, which isn't valid code since there's no field in game objects that automatically finds custom components
like I mentioned on twitter, GetComponent<RegularPolygon>() is the correct way to get those components, and if you get that error or it doesn't work, then it's somewhere in your code that there's either a syntax error or you have some weird caching issues where Unity isn't compiling the latest scripts for you