So, I have a script that rotates based on mouse input. How do I make it so it affects the two gameobject variables in the script rather than the object that the script is attached to?
Rather than just affecting your current object’s Transform, you can simply affect other ones instead through the GameObject variables.
// C#
public GameObject otherObj1;
public GameObject otherObj2;
// ...
// Replace something along the lines of...
transform.rotation = rotationFromMouse;
// ... with something like:
otherObj1.transform.rotation = rotationFromMouse;
otherObj2.transform.rotation = rotationFromMouse;