When I click to higher or lower button, Guess number area not working properly

Hey guys.Here is my game.I need your help.I added some musics and a video my Number Wizard Game.In the game scene when i click higher or lower button, numbers aren’t displayed properly.

Please help me.I’ve been working on this game for days and finally sorry for my bad english :slight_smile:

Hello Yunus,

Absolutely nothing to apologise for regarding your English :slight_smile:

The link you have provided for your game doesn’t appear to work, the site just seems to time out.

Could you perhaps provide a screenshot in your reply which shows the issue?

1 Like

Thank you for your understanding Rob.
I uploded my game again.
The issue is webgl form i think.The game is working perfectly in Unity editor but in browser it gives me error something like this,

I think this is something to do with where you are displaying your numbers to guess as in that upload i either get numbers with digits missing or a blank space.
I would look into the sizing of the UI as that is where the error seems to point.

Rob may have a better insight though

1 Like

My Game Scene canvas like this,


and I’m calling the background video from StreamngAssets folder.Plus I have a video script for run the video.

Much like @Marc_Carlyon has mentioned, it’s most likely going to be the size of the text box you are outputting the concatenated string to.

I would imagine what is happening is that when a number is added to the text, in some cases it fits the UI Text box you have placed, but in some other cases it doesn’t, so it then wraps a digit, or more around to the next line. You obviously can’t see the next line because the height of the UI Text box isn’t tall enough.

The suggestion would be to extend the right hand edge of the UI Text box a little further so that the value fits, or, create a separate UI Text box for the static text, and have a UI Text box just for the guess, you can then make sure the box is plenty large enough and perhaps right-align the text so that it also looks nice.

Hope this helps.

1 Like

I applied your solution but nothing happened so I decided to run the game in mozilla.
It gave this error on console,
Ekran Alıntısı

I think real problem is in the video itself.Video and canvas size are colliding

Hmmmm…

Everything I’m reading about suggests the texture being used for the video hasn’t received any content from the video file itself, as if it hasn’t loaded.

Could you share the project files so I can take a look in more detail?

The forum will support an upload of up to 10mb, but if your project is over that when zipped up your could use Google Drive or Dropbox etc.

Okay Rob. So many thanks for your understanding.
Here is my game files.

Hi Yunus,

Sorry for the delay responding, I spent a little time on this last night but was fairly tired, so had another look this morning.

After a few hours and a variety of different builds, I believe I have found a solution for you, based on the project files you provided above.


Solution;

  • open your Game scene

  • select the Canvas within the Hierarchy

    • set the Render Mode to Screen Space - Camera

    • set the Render Camera to Main Camera
      image

    • untick your video script component
      image

  • add a Video Player GameObject to the scene
    image

    • configure the Video Player as follows within the Inspector
      image
  • create a new script within Assets called Video2

    • edit the script, replacing the content with the following;

      using UnityEngine;
      using UnityEngine.Video;
      
      public class Video2 : MonoBehaviour 
      {
          VideoPlayer videoPlayer = null;
      
          /// <Summary>
          /// Pre-initialisation
          void Awake()
          {
      	    videoPlayer = GetComponent<VideoPlayer>();
      	
      	    videoPlayer.url = Application.streamingAssetsPath + "/tenor.mp4";
      	
      	    videoPlayer.Prepare();		
          }
      
          /// <Summary>
          /// Initialisation
          /// </Summary>	
          void Start () 
          {		
      	    videoPlayer.Play();
          }
      }
      
    • add the video2 script as a component to the Video Player GameObject
      image

    • build and run


Notes;

  • calling the video player’s Prepare() method removes the slight delay that occurred before the video appeared when a scene was loaded, larger videos may require use of the prepareCompleted event

  • I deliberately haven’t deleted your script so that you can compare / rename / tidy up, once you are happy with the changes I would recommend changing the Start scene also, just for consistency

  • I am not convinced that the video support Unity offers for WebGL is bug free, this is a work around rather than an ideal solution - the change in render modes on the canvas effects the other UI components

  • the above has been tested both on local host and a remote hosting platform with Google Chrome

  • using Google Chrome you can see the error message (prior to this fix) and anything else you choose to output to the log;

    • right-click on any white space on the page

    • select Inspect
      image

    • click on the Console tab
      image

    • console log information is displayed;

    • you could use this to validate the guesses that are being displayed in the game by adding;

      Debug.Log("The guess was : " + guess.ToString());
      

      to the NextGuess method within NumberWizard.cs, I would added it after the text.text = statement.


I hope this helps, and again, my apologies for the delay. :slight_smile:





See also;

1 Like

Rob problem is resolved.I can not thank you enough.You spent your precious time for me.
Finally, Thank you so much and Good luck :grinning:

1 Like

You’re more than welcome Yunus, it’s not perfect but it is at least working. I would imagine there will be more improvements to the video functionality in future releases of Unity :slight_smile:

Privacy & Terms