Rotate Object while placing it in Gameworld

Hi guys.
I have a problem, i tried to create a simple “place object from inventory into gameworld” script. placing works fine but i have some problems with the rotation. the object should rotate slowly around itself while pressing A. here is the script:

using UnityEngine;
using System.Collections;

public class BuildingPlacement : MonoBehaviour {

	public float scrollSensitivity;
		
	private PlaceableBuilding placeableBuilding;
	private Transform  currentBuilding;
	private bool hasPlaced;
	
	public LayerMask buildingsMask;
	
	private PlaceableBuilding placeableBuildingOld;
	
	// Update is called once per frame
	void Update () {
	
		Vector3 m = Input.mousePosition;
		m = new Vector3(m.x,m.y,transform.position.y);
		Vector3 p = camera.ScreenToWorldPoint(m);
		
		if (currentBuilding != null && !hasPlaced){
			//rotate object
			if (Input.GetKey(KeyCode.A))
    		transform.Rotate(Vector3.down * speed * Time.deltaTime);
			
			currentBuilding.position = new Vector3(p.x,0,p.z);
			
			if (Input.GetMouseButtonDown(0)) {
				if (IsLegalPosition()) {
					hasPlaced = true;
				}
			}
		}
		else {
			if (Input.GetMouseButtonDown(0)) {
				RaycastHit hit = new RaycastHit();
				Ray ray = new Ray(new Vector3(p.x,8,p.z), Vector3.down);
				if (Physics.Raycast(ray, out hit,Mathf.Infinity,buildingsMask)) {
					if (placeableBuildingOld != null) {
						placeableBuildingOld.SetSelected(false);
					}
					hit.collider.gameObject.GetComponent<PlaceableBuilding>().SetSelected(true);
					placeableBuildingOld = hit.collider.gameObject.GetComponent<PlaceableBuilding>();
				}
				else {
					if (placeableBuildingOld !=null) {
						placeableBuildingOld.SetSelected(false);
					}
				}
			}
		}
	}

	bool IsLegalPosition() {
		if (placeableBuilding.colliders.Count > 0) {
			return false;
		}
		return true;
	}
	
	public void SetItem(GameObject b) {
		hasPlaced = false;
		currentBuilding = ((GameObject)Instantiate(b)).transform;
		placeableBuilding = currentBuilding.GetComponent<PlaceableBuilding>();
	}
}

The wrong line is on line 25 and marked with //rotate object.
Unity says:

  • The name “speed” does not exist in the current contex
  • The best overloaded method match for `UnityEngine.Transform.Rotate(UnityEngine.Vector3)’ has some invalid arguments
  • Argument #1' cannot convert object’ expression to type `UnityEngine.Vector3’

yeah. and to be honest… i have no idea whats wrong.
could you help me please? thanks!

Hello there,

You forgot to define speed.

Hope this helps,
Benproductions1