Hi,
I wonder if there is a way to instantiate a new object by changing its public variables?
For example, I have a player who spawns creatures.
I have player’s name as a variable in PlayerScript:
var PlayerName:String;
... // somewhere in the script:
PlayerName = "Player1";
...
Instantiate_With_Name(CreatureClone,PlayerName)
so that CreatureScript receives this PlayerName and assigns its name to “Player1’s Creature” with something like:
// CreatureScript:
var CreatureName:String;
//....
function constructor(GotPlayerName){ //I know this is probably a wrong syntax, but anyway
CreatureName = GotPlayerName + "'s Creature";
}
I hope I made myself clear.
I just want to pass parameters between Parent Child GameObjects.
How can I do this? Thanks in advance.