When creating a Shader in Unity, you can add a Property to it that can be called from inside of a different script. To do this, one could use the following line to call on and set a Vector3 Property names _vector3
:
materialName.SetVector("_vector3", new Vector3(1, 1, 1));
This is great and all, but is there really not a way to avoid using 'magic' Strings? Seems like an awfully messy and error-prone way to do this. I get that maybe you could define it at the top so it is less of a 'magic' String, but it is still a string var that will need to be carried through from the Shader to the script when making any changes.
So pretty basic question here: Is there a way to avoid using 'magic' Strings when calling on variables in Unity?