float into an vector error, how can i handle it?

hi all, im trying to use a random float as a component of a vector, but it dosent seems to works for some reason, it tells me that unity cannot convert float type into a vector

ranPos = Random.Range(limitSouth, limitNorth);
raPos = (northLimit.transform.position.x, ranPos);

any idea what i should do? thanks for the help

Did you mean this?

new Vector2(northLimit.transform.position.x, ranPos);

It’s hard to decode what you want to do if you don’t write down exactly what you’re doing.

2 Likes

yeah, thats exactly what i wanted buddy, sorry i thought it was clear, what im trying to get its a random position between two points to use as a new y postion in a vector, and with that simple change it compiles, thanks a lot!

raPos = new Vector2(northLimit.transform.position.x, ranPos);

1 Like