I am programming an endless runner that manipulates an airplane with the flexion of the wrist. I have a set of prefabs that move in front of the player. I have a simple prefab, it's a platform and an object called "Bone" as a child. his "Bone" each time the player touches it gives him 1 pt. However, I want to know (if possible) how to change the position of this child object via script. I have written a rough code of the main idea:
//This is my main prefab
var assetPath = "Assets/BonusH.prefab";
//Find the child "Bone"
var bone = GameObject.Find("BonusH/Bone");
//Edit mode
using (var editingScope = new
PrefabUtility.EditPrefabContentsScope(assetPath))
{
//Set the new location inside the prefab
bone.transform.Translate(1,1,1);
}