Quantcast
Channel: Questions in topic: "web player"
Viewing all articles
Browse latest Browse all 531

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

$
0
0
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][1] [1]: https://user-images.githubusercontent.com/9289861/57390715-fa48a080-718a-11e9-9008-8881fa5d8da2.PNG The call: The component: Vue.component('unity', { template:` `, 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() }) } } });

Viewing all articles
Browse latest Browse all 531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>