Is it possible to make a variable that can change Types while running? Example 2 follows my question

Okay, basically I want to have a var called script; however, I want to be able to change it between different variable Types.

P.S: Please ignore the obvious resource-intensive stuff, I’m too lazy to actually create a full script as an example.

NOT this:

var otherVar = 3;
var script = "";

script = otherVar.ToString();
print(script);         // would print 3

// do other stuff with script variable

script = (2.5f).ToString();
print(script);         // script would print 2.5f

But this:

var script;
if ( exObj.GetComponent<baseEnemy>() ) {
    script = exObj.GetComponent<baseEnemy>(); 
else if ( exObj.GetComponent<baseBoss> ){
    script = exObj.GetComponent<baseBoss>();
    script.takeBossDamage(damage * .5f)

I think you’re referring to an issue I once had:

But you should make a parent class that childs both baseEnemy and baseBoss, and like how I setup a method to call the parent class to function through any of it’s children, is basically what you’re looking for. However I’m not sure of what you mean by Types and Running?