Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Scene in Canvas Problem Help

Discussion in 'Scripting' started by goeywonder123, Aug 15, 2023.

  1. goeywonder123

    goeywonder123

    Joined:
    Jul 19, 2023
    Posts:
    6
    Hello, I'm having a problem here. I'm using Unity 2015 here as a beginner to self-study Unity 5.41f1 and I'm encountering errors regarding the scene. When I clicked area001 the textbox seems fine it appears but when I go to TitleScreen and click either New Game or Load Game, the canvas textbox is not appearing. Can someone tell me how to fix it?

    here is the link of the file and the video of my particular problem
    https://drive.google.com/drive/u/2/folders/1e5vBQc43t-c6YmV8NR73DYd2OF6nWyuW
     
  2. wideeyenow_unity

    wideeyenow_unity

    Joined:
    Oct 7, 2020
    Posts:
    728
    To be honest, Unity has changed multiple times over since 2015, so without having a more updated version, it is possible someone can recommend something that wasn't implemented back then.
     
    CodeSmile likes this.
  3. wideeyenow_unity

    wideeyenow_unity

    Joined:
    Oct 7, 2020
    Posts:
    728
    Also I'm not familiar with how google docs work, so without seeing code pasted into the snippet tab, or a link to a youtube shortcut, I sadly can be of no help. :(
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    Exactly, unless the system you run this on is about as old as Unity 5 (~10 years / about 2012) and is running an OS of the time you should really be using the most current 2021.3 or 2022.3 LTS versions.

    Unity 5 doesn‘t support many of the platforms anymore, for instance you cannot build for or at least cannot publish for mobile platforms. WebGL is also severely limited, it may even still require the long deprecated Webplayer installation. And lastly, Unity 5 may have issues if you run it on more modern OS like Win10/11.

    If you work off a tutorial or book that uses this Unity version, find one that‘s more up to date.
     
  5. goeywonder123

    goeywonder123

    Joined:
    Jul 19, 2023
    Posts:
    6
    Sorry for inconvenience. I noticed the problem


    Code (JavaScript):
    1. //This script will load the save data we created
    2.  
    3. var filename ="savegame.data";
    4. var LoadCode : String;
    5. static var GlobalLoad : String; //reference this particular scripts within the game
    6.  
    7. function Start () {
    8.     var OurFile : StreamReader = new StreamReader (filename); //read the stream within the file
    9.  
    10.     line = OurFile.ReadLine();
    11.         while (line != null) { //while not empty
    12.             LoadCode = line;
    13.             line = OurFile.ReadLine();
    14.         }
    15.  
    16.         OurFile.Close();
    17. }
    18.  
    19.  
    20. function LoadGame () {
    21.     GlobalLoad = LoadCode;
    22.     Application.LoadLevel (1);
    23. }
    24.  
    25. function NewGame () {
    26. //create the actual load code then load the second scene
    27.     GlobalLoad = LoadCode;
    28.     Application.LoadLevel (1);
    29. }
    30.  
    31.  
    32. function QuitGame () {
    33.     Application.Quit();
    34. }
    I think I'm having problems in GlobalLoad = LoadCode;. If I remove it, the textbox glitch can be solved but I I need that to reference this particular scripts within the game. Can you help me how to fix it or pinpoint what is the problem?
    This is the sample video of my problem
    https://drive.google.com/drive/u/2/folders/1e5vBQc43t-c6YmV8NR73DYd2OF6nWyuW
     
    Last edited: Aug 15, 2023
  6. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    I haven‘t seen UnityScript in soooo many years. :eek:
     
    Kurt-Dekker likes this.
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    The above code is in UnityScript (sometimes called Javascript).

    This language is done and gone and no longer supported in modern Unity for at least the past 5 or 6 years.

    The rules for what objects can be referenced from what script language types are based on order of compilation of assemblies. I don't think it's possible to refer to C#-script objects from UnityScript.

    Unfortunately it looks like a lot of the documentation related to UnityScript and how to use it is probably gone or at least very hard to search for, but if you did a concerted search in the internet archive you might find something.

    Since it's only a few lines of code you may wish to consider biting the bullet and refactoring everything into C#.

    This would also enable you to move up to more-recent versions of Unity. I don't recommend ANYTHING beyond 2021. Here are some additional notes about upgrading:

    ISSUES RELATED TO UPGRADING PROJECTS (eg, changing to a higher Unity version)

    Upgrading to a later version of Unity is a one-way process. Any project that has been updated should NEVER be reverted to an earlier version of Unity because this is expressly not supported by Unity. Doing so exposes your project to internal inconsistencies and breakage that may actually be impossible to repair.

    If you want to upgrade to a newer version of Unity, do not even consider it until you have placed your project fully under proper source control. This goes double or triple for non-LTS (Tech Stream) versions of Unity3D, which can be extremely unstable compared with LTS.

    Once you have source-controlled your project then you may attempt a Unity upgrade. Immediately after any attempted upgrade you should try to view as much of your project as possible, with a mind to looking for broken animations or materials or any other scripting errors or runtime issues.

    After an upgrade you should ALWAYS build to all targets you contemplate supporting: iOS and Android can be particularly finicky, and of course any third party libraries you use must also "play nice" with the new version of Unity. Since you didn't write the third party library, it is up to you to vet it against the new version to make sure it still works.

    If there are issues in your testing after upgrading Unity, ABANDON the upgrade, revert your project in source control and be back where you were pre-upgrade with the earlier version of Unity.

    Obviously the less you test after the upgrade the more chance you will have of an undiscovered critical issue.

    This risk of upgrading is entirely on you and must be considered whenever you contemplate a Unity version upgrade.

    Do not upgrade "just for fun" or you may become very unhappy.

    PROPERLY CONFIGURING AND USING ENTERPRISE SOURCE CONTROL

    Please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.

    Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

    You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.

    As far as configuring Unity to play nice with git, keep this in mind:

    https://forum.unity.com/threads/prefab-links-keep-getting-dumped-on-git-pull.646600/#post-7142306

    I usually make a separate repository for each game, but I have some repositories with a bunch of smaller test games.

    Here is how I use git in one of my games, Jetpack Kurt:

    https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

    Using fine-grained source control as you work to refine your engineering:

    https://forum.unity.com/threads/whe...grammer-example-in-text.1048739/#post-6783740

    Share/Sharing source code between projects:

    https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

    Setting up an appropriate .gitignore file for Unity3D:

    https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

    Generally the ONLY folders you should ever source control are:

    Assets/
    ProjectSettings/
    Packages/

    NEVER source control Library/ or Temp/ or Logs/
    NEVER source control anything from Visual Studio (.vs, .csproj, none of that noise)

    Setting git up with Unity (includes above .gitignore concepts):

    https://thoughtbot.com/blog/how-to-git-with-unity

    It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place. Digital storage is so unbelievably cheap today that you can buy gigabytes of flash drive storage for about the price of a cup of coffee. It's simply ridiculous not to back up.

    If you plan on joining the software industry, you will be required and expected to know how to use source control.

    "Use source control or you will be really sad sooner or later." - StarManta on the Unity3D forum boards