- Home /
Question by
TheWhaleDev · Oct 15, 2014 at 03:35 AM ·
error messagebce0034
Error Code BCE0034 expressions in statement must only be executed for their side-effects'
Okay I am trying To access the children of a gameobject and look in a Component to get a variable. That works fine. But I want to change the variable thats in the child object.
Here is the Code. By the way Item.itemId and Item.amount are variables in a class. They are both ints.
for (var child : Transform in transform)
{
if(child.GetComponent(InventoryObject).Item.itemId == 1002)
{
child.GetComponent(InventoryObject).Item.amount == 20;
}
}
And then I get the error code BCE0034. Anyone got any ideas?
Comment
Answer by mattyman174 · Oct 15, 2014 at 04:59 AM
if(child.GetComponent(InventoryObject).Item.itemId == 1002)
{
child.GetComponent(InventoryObject).Item.amount = 20; // Remove the second '='
}
You have an equality where you should have an assignment in line 4.