• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Lozamded · May 09, 2019 at 08:45 PM · webglwebplayerwebsite

Textinputs not working when I implemented "Unity webGL" in VueJS Project

I'm doing in my work educational curses with VueJS, when I export Unity resources, the text inputs and text area, are not working. alt text

The call:

  <unity src="UnityResources/Build/cubito.json" width="600" height="400" unityLoader="UnityResources/Build/UnityLoader.js" ref="myInstance"></unity>


The component:

     Vue.component('unity', {
         template:`
               <div class="webgl-content">
                 <div id="unity-container" v-bind:style="{ width: width + 'px', height: height + 'px' }"></div>
                 <div v-if="loaded == false">
                   <div class="unity-loader">
                     <div class="bar">
                       <div class="fill" v-bind:style="{ width: progress * 100 + '%'}"></div>
                     </div>
                   </div>
                 </div>
                 <div class="footer" v-if="hideFooter !== true">
                   <a class="fullscreen" @click.prevent="fullscreen">Fullscreen</a>
                 </div>
               </div>
                 `,
         props: {
                 src: String,
                 module : String,
                 width: String,
                 height: String,
                 externalProgress: String,
                 unity_loader: String,
                 hideFooter: Boolean,
             },
         data () {
           return {
             gameInstance: null,
             loaded: false,
             progress: 0,
             error: null
           }
         },
         methods: {
                 onClick () {
                     this.$refs.myInstance.message("object", "method", "param")
                 },
                fullscreen () {
             this.gameInstance.SetFullscreen(1)
           },
           message(gameObject, method, param) {
             if (param === null) {
               param = ''
             }
             if (this.gameInstance !== null){
               this.gameInstance.SendMessage(gameObject, method, param)
             } else {
               console.warn('vue-unity-webgl: you\'ve sent a message to the Unity content, but it wasn\t instantiated yet.')
             }
           }
         },
         beforeMount() {
 
                 console.log(this.unity_loader)
                 console.log(this.src)
 
           if (!this.eventBus) {
             this.eventBus = new Vue({
               data: {
                 ready: false,
                 load: false
               }
             })
           }
 
           if (typeof UnityLoader === 'undefined' && this.unity_loader && !this.eventBus.load) {
             const script = document.createElement('SCRIPT')
             script.setAttribute('src', this.unity_loader)
             script.setAttribute('async', '')
             script.setAttribute('defer', '')
             document.body.appendChild(script)
             this.eventBus.load = true
             script.onload = () => {
               this.eventBus.ready = true
               this.eventBus.$emit('onload')
             }
           } else {
             this.eventBus.ready = true
             this.eventBus.load = true
           }
         },
         mounted () {
           const instantiate = () => {
             if (typeof UnityLoader === 'undefined') {
               let error = 'The UnityLoader was not defined, please add the script tag ' +
                 'to the base html and embed the UnityLoader.js file Unity exported or use "unityLoader" attribute for path to UnityLoader.js.'
               console.error(error)
               this.error = error
               return
             }
             if (this.src === null) {
               let error = 'Please provice a path to a valid JSON in the "src" attribute.'
               console.error(error)
               this.error = error
               return
             }
             let params = {}
             if (this.externalProgress) {
               params.onProgress = UnityProgress
             } else {
               params.onProgress = ((gameInstance, progress) => {
                 this.loaded = (progress === 1)
                 this.progress = progress
               })
             }
             if (this.module) {
               params.Module = this.module
             }
             this.gameInstance = UnityLoader.instantiate('unity-container', this.src, params)
           }
 
           if (this.eventBus.ready) {
             instantiate()
           } else {
             this.eventBus.$on('onload', () => {
               instantiate()
             })
           }
         }
       });
 
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by atiqanazir15 · Apr 24, 2020 at 09:04 AM

@Lozamded did you find any solution because i have the same kind of project and facing the same issue i can't figure out the solution my project is stuck :(

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

117 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

problem uploading my game to a web page 0 Answers

How to feature WebGL build on SquareSpace? 1 Answer

Embed a WebGL game on an old Google Sites? 0 Answers

Memory Access Out of Bounds - WebGL 1 Answer

Unity version, WebPlayer, WebGL related inquiries 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges