here is the code:
class 2 derives from class 1:
void setSelfClassRef()
{
//set this.gameobject ref
selfGameObjectRef = this.gameObject;
//set class to selfAsClass var
selfClassAsString = this.ToString();
selfAsClass = selfGameObjectRef.GetComponent(System.Type.GetType(selfClassAsString));
}
//
void Awake()
{
//
setSelfClassRef();
//
setEntityUp_1(selfGameObjectRef, selfAsClass);
//
///
}
=====================================================================================
Class 1 :
public void setEntityUp_1(GameObject _self, Component _selfClass)
{
//Init working vars
GameObject MySelf;
Component MySelfClassType;
//Set working var values
MySelf = _self;
MySelfClassType = _selfClass;
//WORK
MySelfClassType.nameOfVariableInsideClass1= this.transform;
}
//
only ‘this’ seems to work, but I dont want this, I want to be able to reference a class as a parameter, Component doesnt seem to work.
basically, at runtime, I dont plan on knowing the name of the class, unless I have to store it as a string and keep getting it each time as a component class.