Forum rules - please read before posting.

Split-Screen Hotspots

Hello,

Is there anyway to have both cameras in a split screen setup respond to clicks? I have hot spots in both section and would like to be able to got back and forth between them in split screen.

Thanks!

Comments

  • Only the MainCamera can be used to detect Hotspots, so it can only be the one camera at a time.

    However, it may be possible for a custom script to swap the two cameras around based on the cursor's position.

    What are your current split-screen settings?

  • I see.

    Currently the split screen has a Horizontal Orientation with spacing of 0.497.

  • OK, add this to a new script named SplitSwap and add it to the scene:

    using UnityEngine;
    using AC;
    
    public class SplitSwap : MonoBehaviour
    {
    
        float lastFrameMouseY;      
    
        void Update()
        {
            var mouseY = KickStarter.playerInput.GetMousePosition().y / Screen.height;
    
            if ((mouseY < 0.5f && lastFrameMouseY >= 0.5f) ||
                (mouseY >= 0.5f && lastFrameMouseY < 0.5f))
            {
                KickStarter.mainCamera.SwapSplitScreenMainCamera();
            }
    
            lastFrameMouseY = mouseY;
        }
    
    }
    

    To stop this from taking effect while no split-screen effect is active, open up AC's MainCamera script, and look for the SwapSplitScreenMainCamera function around line 1300. Add this to the top of it:

    if (!isSplitScreen) return;
    

    (I'll add the same change to the next release)

  • edited 1:00AM

    You are the absolute best! Would this work with a vertical split screen as well? Just change the mouseY to mouseX and other relevant variables?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.