I have a powerup (prefab) that changes the scale of a gameObject (prefab). However, my code is altering the prefab’s values and not the instance of the prefab.
public class WiderPowerUp : PowerUp
{
[SerializeField] Paddle paddle; //Game Object being scaled
protected override void TriggerPowerUp()
{
Vector3 scale = paddle.gameObject.transform.localScale;
scale.x += 0.1f;
paddle.gameObject.transform.localScale = scale;
}
}
Is it possible to pass the local instance of a prefab to my script via [SerializeField], or do I have to use GameObject.Find()?