To Assign SkinnedMeshRenderer by Code (without Getting Syntax Error)
$30-250 USD
Σε Εξέλιξη
Αναρτήθηκε περίπου 6 χρόνια πριν
$30-250 USD
Πληρωμή κατά την παράδοση
Currently, SkinnedMeshRenderer on a player is assigned manually on the Inspector (if you know Unity 3D well), in replacing the prop or clothes he is [login to view URL] it is working, proven from my PC! On the attachments below, I would like to assign that by way of code, but getting syntax errors. Something wrong about the lines below. Attachments illustrated of original script
Not sure why you can't pinpoint to the Cube object on the Player 1 without getting an error:
-------------------
targetMesh = [login to view URL]("Player 1").[login to view URL]("Cube").gameObject;
-------------------
, and then change the clothes it is wearing.
Codes:
public SkinnedMeshRenderer targetMesh;
GameObject target;
.
.
.
public void Equip(Equipment newItem)
{
.
.
.
[login to view URL] = [login to view URL];
.
.
.
}
void Update()
{
if ([login to view URL]("Player 1") != null)
{
/* Player */
targetMesh = [login to view URL]("Player 1").[login to view URL]("Cube").gameObject;
// [login to view URL]("targetMesh gameObject is " + targetMesh);
}
Actual script, a 1-page C# file, is attached for reference.
Hi,
I'd like to do this,
but first I'd like to see the code,
thanks
Kumar
..................................................................................................................................................................................................................
Hey there
Our studio has done a lot of games using Unity3D as you can see from our profile, we would love to talk more about the project and start working on it.
Whether you're looking for a quick job or long-term commitment we're happy to help.
Hope to hear from you soon.
Omni Team