Can parenting different instances of the same networked prefab to the same parent cause an error of logid= ToolkitCommandNumCommandBindings whenever one of them send commands?
For a more concrete example:
The Nesting Prefabs at Edit time | coherence Documentation mentions a cargo truck example. Considering that setup, if one of the Cargo scripts send a command to one of its methods, would it cause an issue like “Trying to send a single command, but Cargo is bound to more than one component.“?
CoherenceSync provides overloads for SendCommand to target specific instances. This is the way to go if you experience any issues regarding not finding the exact command.
The way SendCommand can pick up what specific component you want to target, is through an action/delegate, which you can read about here.
So, doing this:
// this is the command, thus has to be public
public void Foo()
{
Debug.Log("Foo");
}
private void OnGUI()
{
if (GUILayout.Button("Send Command"))
{
GetComponent<CoherenceSync>().SendCommand(Foo, MessageTarget.All);
}
}
You ensure the specific component instance.
If you want to target another component (incl. components in other GameObjects through the hierarchy), you can do this: