Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Using Google ChromeCast From an Android/iOS Game Built in Unity

Discussion in 'Formats & External Tools' started by plyrek, Feb 26, 2020.

  1. plyrek

    plyrek

    Joined:
    Mar 2, 2015
    Posts:
    15
    Hello,

    I am looking for some direction for building a game in Unity that allows a player to mirror or cast game results and cinematic's to a Google ChromeCast. I am surprisingly finding very little information about it. I thought it would be more ubiquitous given how many apps can cast to your TV these days. Unfortunately, when it comes to Unity, the only real information about it has been a depreciated Google plugin in the Asset Store from 2016 that obviously does not function.

    I am hoping someone on the forum has experience creating there own plugin for ChromeCast or know of a tutorial for creating a connection to ChromeCast and can point me in the right direction.

    Any assistance would be greatly appreciated.

    Thank you.
     
    Josh99gb likes this.
  2. RobAtApex

    RobAtApex

    Joined:
    Jun 19, 2017
    Posts:
    21
  3. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,492
    My 0.2 cents:
    -Can't you just cast the whole desktop via chrome browser, why would that not work? Then just play the game.
    -Other option is to import some c# sdk/library (quick search I find https://github.com/Tapanila/SharpCaster or https://github.com/kakone/GoogleCast) to your game source, make use that api to cast direct from the game, not sure of the legalities if that would be allowed, or even work, maybe you can post your results here.
     
  4. RobAtApex

    RobAtApex

    Joined:
    Jun 19, 2017
    Posts:
    21
    The question was about casting from Android and iOS. Not sure if chrome browser app can do that to cast other apps on either of those platforms, but also we want users not to have to go to that trouble and cast directly from our apps.

    Those links might be useful failing all else, but probably means writing separate plugins for each platform or some kind of per-platform integration to get this working in Unity. First one talks of Xamarin so not sure if that's usable from Unity.
     
  5. EmpireStudios

    EmpireStudios

    Joined:
    Oct 23, 2018
    Posts:
    24
    Wow, can't believe Unity doesn't support this. This must be some kind of road block by Google. Who would buy their Stadia games if anyone could just cast a Steam or App game from their phone? It's basically the same thing as the Stadia.
     
  6. johnnparry55

    johnnparry55

    Joined:
    Oct 9, 2020
    Posts:
    3
  7. Moorepl

    Moorepl

    Joined:
    Dec 14, 2022
    Posts:
    2
    Hi Guys
    Did anybody ever get this working, particularly by building their own plugin for Unity? I'm trying to develop educational games/content for kids in a mobile app (ios and android) but need to be able to natively cast to chromecast. The handshake from mobile device to chromecast seems to use a pretty simple multi-cast discovery protocol and I didn't notice anything proprietary that would prevent a handshake from an app built similarly to the Cast SDK, or am I missing something?
    Appreciate any guidance or help in this space folks.
     
  8. mgstauff

    mgstauff

    Joined:
    Sep 6, 2017
    Posts:
    59
    It's a bit of a lift but you can use Unity Render Streaming plugin to stream to a browser window. There's a demo project for this and you can even interact with the app through the browser. It's built on WebRTC which Chromecast uses so there may be some direct Chromecast support possible too. You should ask on the URS forum.

    https://docs.unity3d.com/Packages/com.unity.renderstreaming@3.1/manual/index.html
    github: https://github.com/Unity-Technologies/UnityRenderStreaming
    forum: https://forum.unity.com/forums/unity-render-streaming.413/
     
  9. Moorepl

    Moorepl

    Joined:
    Dec 14, 2022
    Posts:
    2
    Cheers mgstauff, i'll look into the links and submit query on the URS forum. I really appreciate the help mate.