FindComponentInPlayerObjects not working with UdonBehaviors attached to child object
available in future release
Vincil
- create a PlayerObject template with a child object and attach a UdonBehavior to that child object
- Using a reference to that child UdonBehavior, attempt to access this behavior from another behavior via FindComponentInPlayerObjects during OnPlayerRestored
Here is the code I trigger the issue with:
public override void OnPlayerRestored(VRCPlayerApi player)
{
if (Utilities.IsValid(player))
{
PlayerManager playerManager = (PlayerManager)Networking.FindComponentInPlayerObjects(player, _playerManagerTemplateReference);
if (Utilities.IsValid(playerManager))
{
playerManagers[player.playerId] = (PlayerManager)Networking.FindComponentInPlayerObjects(player, _playerManagerTemplateReference);
}
else
{
LogError($"Failed to load player manager for {player.displayName}");
}
}
}
And included are the errors it produces. Also included is the hierarchy structure of the template.
Note: my code works fine if I move the UdonBehavior to the parent and try to access it from there. And yes I am making sure to update the UdonBehavior reference and regenerate scene ids between tests.
Log In
This post was marked as
available in future release
StormRel
tracked
Vincil
StormRel In case this information is useful to you, tested it and the issue is also present in 3.7.4-persistence-beta.1