I’ve made a cube prefab and when it’s created, it receives values from the main camera’s script.
var player : Transform;
var thescript = player.GetComponent("Stats");
var hitBoxCount : int;
function Start () {
Populate(1, 2, 1, 0, 0, -28);
yield WaitForSeconds(1);
Populate(2, 14, 2, 0, 0, -22);
}
function Populate(Player : int, Character : int, Team : int, x, y, z){
Instantiate(player, Vector3(x,y,z), transform.rotation);
player.GetComponent("Stats").Player = Player;
player.GetComponent("Stats").Character = Character;
player.GetComponent("Stats").Team = Team;
}
The values make it through, but only to the original prefab that I have in the Project panel, not the ones in the Hierarchy. I know this because whenever I start and restart the script, the original’s values change from 0, to the first set of parameters of Populate, to the second and it just gets stuck there. I reset the values of the “Stats” script, but it does the same thing again. Does anyone have any idea how to just edit the “Clones” of a prefab and not the original?