I have been racking my brain for the past few days, and every solution I try seems to fail,so i;m wondering if anyone can please help me. I’m quite new to Unity.
I have a script which is attached to a cube, and the script allows you to change the pivot point of an object, and you can set the x y z pivot under the inspector when the cube is selected.
A screenshot attached shows the code and the “RotateAroundPivot” options in the inspector.
What I would like to do is from a totally different C# script, change the x y or z value for that cube, so rather than being x: 0 it would be x:35
So, is it possible to place some code within
public void SetCubePivot() { }
that would alter those pivot values for the cube
Hopefully that makes sense
Thanks very much, it would be a real help if someone can give me some advice
If I understand you correctly, you would simply get a reference to the RotateAroundPivot component (for example using GetComponent), and then update its Pivot property, e.g.: