Physbones cannot be grabbed in-editor if more than one camera is present in scene
Kilerbomb
If more than one camera is present and enabled within your Unity scene upon entering playmode, Physbone components cannot be grabbed in the Game window.
Log In
bd_
This bug is caused by this code in PhysBoneGrabHelper:
//In Unity 2021.2 this can be replaced with Display.activeEditorGameViewTarget, allowing us to remove all dependencies on UnityEditor
Camera FindCamera()
{
//Get target display
var gameView = UnityEditor.EditorWindow.focusedWindow;
if(gameView == null || !gameViewType.IsInstanceOfType(gameView))
return null;
var targetDisplay = (int)targetDisplayField.GetValue(gameView);
//Find camera with matching target
Camera result = null;
var cameras = Camera.allCameras;
foreach(var camera in cameras) //Get the last active camera
{
if(camera.isActiveAndEnabled && camera.targetDisplay == targetDisplay)
result = camera;
}
return result;
}
Since this isn't checking for a render texture on
camera
, if you have a camera with a render texture on an avatar, but its targetDisplay is still Display 1, then it potentially selects the avatar camera instead of the desired game mode camera.As the comment says, this can now be replaced by Display.activeEditorGameViewTarget as a fix, or it can just check for targetTexture == null if that doesn't work for some reason.
bd_
Workaround: Set "Target display" on your cameras to display 8.
Smash-ter
One year later and this problem has not been addressed
Free hugs․․․
I could work with 2 or more cameras in the same scene. The problem started happening when the other camera had a Target Texture defined on it. See video. First time it works fine. Second time when I add to the other camera a target texture then it stops working.
Photo Viewer
View photos in a modal