Getting a Script without setting a variable to the script name


I am making a script that can be used in multiple gameobjects, but requires a different script for different gameobject. For Example, a player would have a movement script input and an enemy would have AI script. This is what i am trying to achieve:

Script Movement;

if ( == "Player")
     Movement = GetComponent<MovementScript>();
else if ( == "Enemy")
     Movement = GetComponent<AIScript>();

How can this be done?

Don’t think so, you have to think more object oriented for these kind of things.
I wrote an example for beginners how to manage item structures, is for sale | HugeDomains

Same can be used for enemies for finding out the type.
When you know the type you can use good old switch case.

This will work for simple things.

private void HitObjectHandler(GameObject go){ //receive object from ray hit (example)
    case "Npc":
        NpcType npcScript = go.GetComponent<NpcType>();

public void FindType(short arg){
        case 0:
        Debug.Log("its a player");
        case 1:
        Debug.Log("its a dead meat");
        //Ninja kitten
        case 2:
        Debug.Log("its a ninja");