I am a beginner at Unity in terms of skill so please explain as if you were talking to a child if you can!
PROBLEM
I would like to change these names here:
I would like to rename them for two reasons:
so they are more intelligible
because I am using many different assets from the store and each has a different hierarchy with different names and I want to standardize the names so that I can use the below code to determine which part of the creature's body was shot so that it works for every creature
public void CreatureHit(string bodyPart, GunInfo usedWeapon, float intensity) // for guns { usedWeapon.PlayHit(creatureSounds); if (creatureInfo.healthPoints > 0) // to prevent dead creatures from being shot { if ("Torso" == bodyPart || "LeftUpperArm" == bodyPart // if the part that was hit was the arms or torso || "RightUpperArm" == bodyPart || "LeftLowerArm" == bodyPart // if the part that was hit was the arms or torso || "RightLowerArm" == bodyPart) { creatureInfo.healthPoints -= usedWeapon.damage * intensity; // deal standard dmg if (creatureInfo.healthPoints <= 0) creatureInfo.deathType = CreatureInfo.BODYSHOT; } else if ("Head" == bodyPart) // if the part that was hit was the head { creatureInfo.healthPoints -= usedWeapon.damage * 10 * intensity; // deal 10x dmg audioSource.PlayOneShot(creatureSounds.hitHead, 1); if (creatureInfo.healthPoints <= 0) creatureInfo.deathType = CreatureInfo.HEADSHOT; } else if ("RightUpperLeg" == bodyPart || "LeftUpperLeg" == bodyPart || "RightLowerLeg" == bodyPart || "LeftLowerLeg" == bodyPart) { creatureInfo.healthPoints -= usedWeapon.damage / 2 * intensity; // deal half dmg if (creatureInfo.healthPoints <= 0) creatureInfo.deathType = CreatureInfo.BODYSHOT; } } }
WHAT I TRIED
I renamed them in the hierarchy but then the animations stopped working. I found an old thread from the Unity forum asking if this was possible in 2015 and the OP was told that it wasn't. There were some later technical replies and I felt overwhelmed so I thought I should just create my own thread.
NOTE: there are multiple dozens of characters each with 10+ animations so ideally I need a very efficient solution.