Function to assign gameobject components with parameter strings...

Basically, is there a reasonable way to make a function have a string argument used to assign as a name for a new GameObject?

Like public void thing_maker(string gameobject_name, string sprite_name, string rg_body_name)

I can’t get my ideas to work. Anyone have any ideas?

Something like this ? :

using UnityEngine;
using System.Collections;

public class test : MonoBehaviour {
	GameObject cube;
	GameObject sphere;
	public void newObj(GameObject obj, string Gname, string Gtag, System.Type Gcomp){
		obj.name = Gname;
		obj.tag = Gtag;
		obj.AddComponent (Gcomp);

	}
	void Update(){

		if (Input.GetKeyDown (KeyCode.A)) {
			cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
			newObj(cube, "cube01", "Player", typeof(Rigidbody));
		}
		if (Input.GetKeyDown (KeyCode.D)) {
			sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
			newObj(sphere, "sphere01", "Player", typeof(Rigidbody));
		}
	}
}