I am able to grab everything regardless of tags

I have two issues. 1) I can grab anything and 2) when I let go of those objects they just stay where I let go at, no gravity function after clicking… Here is my current code Unity 5

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class GrabAndDrop : MonoBehaviour {

GameObject grabbedObject;
float grabbedObjectSize;

GameObject GetMouseHoverObject(float range)
{
Vector3 position = gameObject.transform.position;
RaycastHit raycastHit;
Vector3 target = position + Camera.main.transform.forward * range;

if (Physics.Linecast(position, target, out raycastHit))
return raycastHit.collider.gameObject;
return null;

}

void TryGrabObject(GameObject grabObject)
{
if (grabObject == null)
return;
else
if (grabObject.tag == “movable”);
{
grabbedObject = grabObject;
grabbedObjectSize = grabObject.GetComponent().bounds.size.magnitude * 2;
}
}
void DropObject()
{
if (grabbedObject == null)
return;

if (grabbedObject.GetComponent () != null)
grabbedObject.GetComponent ().velocity = Vector3.zero;
grabbedObject = null;
}

void Update () {
if (Input.GetMouseButtonDown(1))
{
if (grabbedObject == null)
TryGrabObject(GetMouseHoverObject(5));
else
DropObject();
}

if (grabbedObject != null)
{
Vector3 newPosition = gameObject.transform.position+Camera.main.transform.forward*grabbedObjectSize;
grabbedObject.transform.position = newPosition;
}

}
}[/code]

Do you have rigidbodies for gravity?

I do yes. But I had went with a different code and everything works. Now my only problem is that when I pick up an object that has more then one part I pick up the individual Mesh instead of the entire object. I am not sure if that is something I can fix.

looks like you’re heading in the right direction, but I’d suggest having a look at the interfaces concept in place of using the tag system, a lot more flexible for what you’re doing.