I am trying to make the scale of my ground object to be scaling up and down depending on the y position of my mouse.
I get an error called error CS1503: Argument 1: cannot convert from ‘float’ to ‘UnityEngine.Vector3’.
Thanks for all the help.
I am a beginner, I started about a month or two ago.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseToScale : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition.y);
Vector3 scaleChange = new Vector3(0f, mousePos, 0f);
transform.localScale += scaleChange;
transform.position = new Vector2(transform.position.x, transform.position.y - mousePos);
}
}
,I am trying to make the scale of my object to the position of my mouse.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseToScale : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition.y);
Vector3 scaleChange = new Vector3(0f, mousePos, 0f);
transform.localScale += scaleChange;
transform.position = new Vector2(transform.position.x, transform.position.y - mousePos);
}
}