Forum Replies Created

Viewing 15 replies - 1 through 15 (of 60 total)
  • Plugin Author pthowe

    (@pthowe)

    @albertcallejo ,

    I gave the short code a try with no quotes and that worked as well.
    Give the short code a try with no quotes of any kind.
    Glad to hear the issue is resolved.

    Thanks

    Plugin Author pthowe

    (@pthowe)

    @albertcallejo ,
    When you enter the short code make sure that you are in the proper mode.

    I copied your sample from the above message. I did find that the quote marks around the items in the short code not normal Double quotes. I replaced them with single quotes and also with double quotes and both options worked for me. Please retry.

    [hs_unity3d_web_gl_game src='Roll-a-ball' height='500' width='600' u3dver='2019.4' buildtype='Production']

    Let me know if this address your issue.

    Thanks

    Plugin Author pthowe

    (@pthowe)

    @bertzero ,

    Glad you are working

    Plugin Author pthowe

    (@pthowe)

    @matcarps , with the information you provided. you are using Unity 5.3.1 That is the default version if you do not provide the “u3dver” parameter.

    in regards to uploading the files I used the dashboard media -> Add New

    The setting are found in two locations, in the Dashboard -> Plugins -> Installed Plugins -> HoweScape Unity3d WebGL
    Also Dashboard -> Settings -> HoweScape Unity3d Game Settings

    If you uploaded through the web site manager the location would be something like: <something>\public_html\wp-content\plugins\howescape-unity3d-webgl\game_dir\<gamename>_<version>-Release\<game files>

    I will mark this case closed Thanks for letting me know you resolved the issue.

    PTHowe

    Plugin Author pthowe

    (@pthowe)

    @matcarps ,
    Have you created the ZIP file?
    Did you upload the ZIP file?
    Did you expand the the ZIP file using the button in the Setting menu?

    Here is a general review of what the short cut should look like:

    [hs_unity3d_web_gl_game src="Roll-a-ball" height="900" width="900" u3dver="2020.3" buildtype="Production"]
    

    The parts are Short Code: ‘[hs_unity3d_web_gl_game ‘
    The parameter to identify the game: ‘src=”GameName” ‘
    The parameter to specify height of game: ‘height=”900″ ‘
    The parameter to specify width of game: ‘width=”900″ ‘
    The parameter to specify which version: ‘u3dver=”2020.3″ ‘
    The parameter to specify build type: ‘buildtype=”Production”] ‘

    Lets pick a game name and version. If you compile your game with Unity3d giving the name “MyGameTester”. For this example we are using version 2020.3.x and we are doing a production build using GZip compression.

    The file name we are going to create and upload is: MyGameTester_2020_3-Release.zip”
    The contents of this file will be:
    MyGameTester.wasm.gz
    MyGameTester.data.gz
    MyGameTester.framework.js.gz
    MyGameTester.loader.js

    The resulting short code should be:
    [hs_unity3d_web_gl_game src="MyGameTester" height="900" width="900" u3dver="2020.3" buildtype="Production"]

    The game name can not contain spaces, underscore or dash because of some choices I made in the code. If you provide the short code you are trying to uses I will give it a review. Thanks for the feedback. Everything I learn makes it better.

    PTHowe

    Plugin Author pthowe

    (@pthowe)

    @bertzero , I have seen the error and am working to understand the issue. In regards to the question about the loading bar. I found one difference which might address the issue. Since you have modified your version of the plugin. Here is a change which may help.

    In the routine hs_unity3d_2020_3 find the line:

    ‘<canvas id=”unity-canvas”></canvas>’

    change it to

    ‘<canvas id=”unity-canvas” width=’.$width.’ height=’.$height.’></canvas>’

    This change will be included in my next update. Please let me know if this helps?

    Peter

    Plugin Author pthowe

    (@pthowe)

    @bertzero ,
    Sorry you were having trouble. I will give the version a test.

    Thanks for letting me know.
    Pthowe

    Plugin Author pthowe

    (@pthowe)

    Updated plugin to have better form processing

    Plugin Author pthowe

    (@pthowe)

    @mkim0818 ,
    I believe I understand the issue. When you install the plugin the delivered games are already expanded. There is nothing to expand. When you create your own game and ZIP file. It will be uploaded to the media folder. Then you need to select an item to be expanded and placed in the Plugin Game directory.

    I am working on an update to prevent this error.

    This issue will also be present if you try to remove a game and do not select an item. If I have missed the issue please let me know.

    Thanks

    Plugin Author pthowe

    (@pthowe)

    Hello @mkim0818 , Sorry you are having an issue. The error is from the routine which removes the old version when adding a new version.

    Can you please let me know the version of WordPress / Unity3d Game version
    Has the game ever been deployed? Is this a new game or an update to a game which was already present?

    I am still working on my testing. I will update when I know more.

    Author

    Plugin Author pthowe

    (@pthowe)

    @krghost ,

    I think I have worked it out. If you look at the online documentation
    https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html

    1. In the Assets create a folder Plugins
    2. Create a file in the folder which has the extension “.jslib”
    3. This file will look like:

    mergeInto(LibraryManager.library, {
      ReturnUserID: function() {
    	return current_userID;
      },
    });

    4. Create a C# Script “AccessJavaScript”

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using System.Runtime.InteropServices;
    
    public class AccessJavaScript : MonoBehaviour
    {
        [DllImport("__Internal")]
        private static extern int ReturnUserID();
    
        void Start() 
        {
          int result = ReturnUserID();
          Debug.Log(result);
        }
    }
    

    Because this is accessing the browser JavaScript, you can no longer use the Unity3d Editor Play.
    In my test I created in the HTML page:

    
    <script>current_userID=1;current_userName=xxxx;</script>
    

    From a short code which extracted current user info and placed in the page.

    Hope this is helpful.
    Please post them.

    Plugin Author pthowe

    (@pthowe)

    Hello @krghost ,

    I know this is not quite what you are trying to accomplish but it is communication between browser and the Unit3D game using my plugin.

    Reference URL From Code Monkey:https://unitycodemonkey.com/video.php?v=3g0N__K7Wlo

    For this I created a Unity3D game. The game is very simple and based on the Code Monkey example above. I created a game object of a circle, 2 UI Text Elements, and a game object linked to a C# script.

    The code in the Script: is the same as in the Code Monkey

    The Code Monkey, has buttons which are in the HTML page that send information into Unity3D game.

    Now there is a name change in the game object used by the plugin. The HTML to add the buttons looks like:

    <div style="border: solid 1px black; width: 200px; height: 30px; margin: auto; text-align: center;" 
    onclick="gameInstance.SendMessage('JavaScriptHook','TintRed')">Red</div>

    The Code Monkey used “unityInstance” the plugin you need to use “gameInstance”.

    To put the HTML buttons on the game page I added the code below the tag which loads the game.

    <script> 
    	var testObject = { name: "John", age: 34};
    	var jsonString = JSON.stringify(testObject);
    </script>
    [hs_unity3d_web_gl_game src="LevelBuild" height="300" width="500" u3dver="2019.4"]
    
    <div style="border: solid 1px black; width: 200px; height: 30px; margin: auto; text-align: center;" onclick="gameInstance.SendMessage('JavaScriptHook','TintRed')">Red</div>

    Let me know if you have questions.

    Thanks
    Peter

    Plugin Author pthowe

    (@pthowe)

    @krghost , For the first part of the project. I am sure you are already aware,

    wp_get_current_user()->ID

    Will get you the current logged in user. The next part is to use the parameters which are passed to the Unity3d object as a parameter.

    with the plugin I created you have:
    [hs_unity3d_web_gl_game src=”Roll-a-ball” height=”500″ width=”600″ u3dver=”2019.4″]

    Nothing prevents you from adding an additional parameter such as:

    [hs_unity3d_web_gl_game src=”Roll-a-ball” height=”500″ width=”600″ u3dver=”2019.4″ User=wp_get_current_user()->ID]

    The trick I have not worked out is how do you deal with special symbols and spaces because this is part of a URL.

    I will have to go look for the code, to extract the parameter into a variable in the UNITY code.

    Look for update

    Plugin Author pthowe

    (@pthowe)

    @krghost ,
    My research keeps leading me back to something like:
    https://weeklyhow.com/unity-restful-api/
    https://hub.packtpub.com/using-rest-api-unity-part-1-what-rest-and-basic-queries/

    I do believe that some browser information can be extracted. What type of information are you trying to extract from the browser?

    I believe you can pass parameters into a Unity3D game.

    Let me know what you are trying to accomplish

    Pthowe

    Plugin Author pthowe

    (@pthowe)

    @krghost , Let me see what I can put together as a test case.

Viewing 15 replies - 1 through 15 (of 60 total)