简体   繁体   中英

Unity3D Player Size Change?

I'm trying to change the size of the player element for a Unity3D game on my site. The problem is, on the HTML document itself, this is what I have from it.

<html>
<head>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript">
        <!--
        var unityObjectUrl = "http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js";
        if (document.location.protocol == 'https:')
            unityObjectUrl = unityObjectUrl.replace("http://", "https://ssl-");
        document.write('<script type="text\/javascript" src="' + unityObjectUrl + '"><\/script>');
        -->
    </script>
    <script type="text/javascript">
    var u = new UnityObject2();
        u.observeProgress(function (progress) {
            var $missingScreen = jQuery(progress.targetEl).find(".missing");
            switch(progress.pluginStatus) {
                case "unsupported":
                    showUnsupported();
                break;
                case "broken":
                    alert("You will need to restart your browser after installation.");
                break;
                case "missing":
                    $missingScreen.find("a").click(function (e) {
                        e.stopPropagation();
                        e.preventDefault();
                        u.installPlugin();
                        return false;
                    });
                    $missingScreen.show();
                break;
                case "installed":
                    $missingScreen.remove();
                break;
                case "first":
                break;
            }
        });
        jQuery(function(){
            u.initPlugin(jQuery("#unityPlayer")[0], "Tug the Table.unity3d");
        });
    </script>  
    <title>Tug the Table - TGH</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" type="text/css" href="style.css">
    <!-- This Template is a WiP - Please report any bugs to the administrative team at The Gaming Hideout. Thank you. All rights reserved. -->
</head>
<body>
<div id="wrap">
    <div id="header">
        <h1><img src="VexIMG/header.png" alt="The Gaming Hideout" width="760" height="60"></h1>
    </div>
    <div id="navigation">
    <div class="navlinks">
    <div id="output2">
    </div>
    </div>
    <script src="nav.js"></script>
    </div>
    <div id="body">
        <div class="game">
        <h2>Tug the Table</h2>
        <div id="unityPlayer">
            <div class="missing">
                <a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!">
                    <img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" />
                </a>
            </div>
        </div>
    <caption>Tug the Table. Theres really nothing else to it.</caption>
    </div>
    <div id="footer">
    <div id="copyright">
        Copyright ? The Gaming Hideout<br>
        We own no rights on any game on this site unless otherwise noted.<br>
        All Rights Reserved.
    </div>
    <div id="footnav">
            <script src="footnav.js"></script>
        </div>
    </div>
</div>

It's sized incorrectly on the page, so I try to browse the code for a way to change the width and height of it, and I get nothing. So I try to edit the element code from the browser, and then I see this from the code in the element browser, that doesn't show up in the HTML.

<div id="unityPlayer">
    <embed src="Tug the Table.unity3d" type="application/vnd.unity" width="100%" height="100%" firstframecallback="UnityObject2.instances[0].firstFrameCallback();" style="display: block; width: 100%; height: 100%;">
</div>

I need to be able to edit my HTML page so it can edit the width: 100% and height: 100% to my own desired size. Any idea on how to do this?

Did you try to use config when creating UnityObject2 instance?

var config = {
            width: 500, 
            height: 300,
            params: { enableDebugging:"0" }
            ,baseDownloadUrl: "http://webplayer.unity3d.com/download_webplayer-3.x/"
    };
var u = new UnityObject2(config);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM