Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Problem with Facebook Playable Ads

Discussion in 'Project Tiny' started by tuandinlygo, Aug 11, 2020.

  1. tuandinlygo

    tuandinlygo

    Joined:
    Mar 23, 2020
    Posts:
    5
    Hi all, I have problem with Facebook Playable Ads. When I up load my exported html5 zip file to Facebook Playable Ads test tool, facebook say my js file can't load, so only my html:
    Screen Shot 2020-08-11 at 3.15.55 PM.png
    This is my result after I upload zip file:
    Screen Shot 2020-08-11 at 3.16.45 PM.png
    What should I do now? Has anyone ever done this?

    For more info. This is my exported html5 zip file:
    exported_html5.zip

    Unity ver 2020.1.0f1, Tiny ver 0.28
    I export to single html file and then I split script part to js file
     

    Attached Files:

  2. JiriS

    JiriS

    Joined:
    Jul 7, 2020
    Posts:
    2
    You need to click the CTA button to direct the user to the store. Did you insert the FbPlayableAd.onCTAClick() call?
     
  3. n653b447

    n653b447

    Joined:
    Apr 22, 2017
    Posts:
    8
    Has anyone solved this problem?
    Could I ask it again here?
    I have searched a lot of information but it is still not working right now.
    However, other people seem to use another way to do it just like using TypeScript.
    Tiny ver 0.31 just can use C#, the other way like the following reference use sconfig.override.json can call JavaScript FbPlayableAd.onCTAClick().

    ref:https://stackoverflow.com/questions/58411016/sdk-for-facebook-playable-ads
    ref:https://forum.unity.com/threads/can...-regular-javascript-code.594064/#post-3968980
    ref:https://forum.unity.com/threads/facebook-playable-ads.628480/
    Unity ver 2020.1.11, Tiny ver 0.31
     
  4. tuandinlygo

    tuandinlygo

    Joined:
    Mar 23, 2020
    Posts:
    5
    Currently, I use another library like Phaser, PIXI or pure javascript to make playable ads. I recommend you write playable ads in pure javascript. It can work on any platform.
     
  5. n653b447

    n653b447

    Joined:
    Apr 22, 2017
    Posts:
    8
    Thanks for your reply, the document has some new tutorial.
    https://docs.google.com/document/d/1A8hen2hLFY5FLkC5gd3JP2Z-IpHfnAX-CpYLK3aOdwA/edit#
    I tried the above link, and check these two topics
    Adding raw JavaScript code to the build
    &
    Using web templates

    but fail...
    way1: try to create js~ & prejs~ folder, write js file like below.
    MySystem.cs

    using System;
    using Unity.Entities;
    using System.Runtime.InteropServices;

    public class MySystem : SystemBase
    {
    [DllImport("__Internal")]
    private static extern void CallRawJavaScriptFunction();

    protected override void OnCreate()
    {
    CallRawJavaScriptFunction();
    }

    protected override void OnUpdate()
    {
    }
    }

    prejs~/MyRawJavaScript.js

    function RawJavaScriptFunction() {
    console.log("[JavaScript] RawJavaScriptFunction");
    FbPlayableAd.onCTAClick();
    window.FBPlayableOnCTAClick = () => {
    (typeof FbPlayableAd === 'undefined') ?
    alert('FBPlayableAd.onCTAClick') : FbPlayableAd.onCTAClick();
    }
    }

    js~/MyPlugin.js

    mergeInto(LibraryManager.library, {
    CallRawJavaScriptFunction: function () {
    RawJavaScriptFunction();
    },
    });

    way2:tiny_shell.html add, also fail...

    <script>
    FbPlayableAd.onCTAClick();
    window.FBPlayableOnCTAClick = () => {
    (typeof FbPlayableAd === 'undefined') ?
    alert('FBPlayableAd.onCTAClick') : FbPlayableAd.onCTAClick();
    }
    </script>