I’ll like to implement a script that a lot of GameObject will share. The idea is that each gameobject will have then a specific script with their own methods.
The idea behind this is to have each gameobject containing diferent level stuff, like backgrounds, animations, specific functions, etc. But then have a specific gameobject with sub managers that will manage common things like menus, gui etc.
I’ll like the main one to be able to load different “scenarios” without knowing which type of scirpt im loading.
I’ll like to use the main script to load on demand the other one
Main:
function loadSpecificScript (n) {
var sc = gameObject.GetComponent(‘specificScript’+n);
}
The problem is that the sc var then doesnt have the correct type as I dont know it in advance.
Any help??