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

No Code Compile Errors But Scripts Won't Load On Objects?

Discussion in 'Scripting' started by JWdell, Jun 25, 2021.

  1. JWdell

    JWdell

    Joined:
    Oct 24, 2014
    Posts:
    54
    OK, I'm hoping someone can point me in the right direction to get over this hurdle. Coming off an old 2018 Unity Editor build because I was forced at the time to stay with using Javascript and couldn't update to a Unity version where Javascript was removed. I've recently rewritten my project in C# and I've updated to the lastest version of Unity 2021.

    Now, just updating to the latest version of Unity, some of you can possibly know the pain I'm dealing with from all the changes made to Unity, all the deprecated things etc., but I'm currently fighting with something I don't know how to deal with.

    I'm getting absolutely no compiling errors in my code at this time. I did on a few 3rd party sources which I updated and those were fixed which now gives me no compiling errors whatsoever. However, every object in my project with scripts attached are not loading at all and tells me to fix compiling errors first. I'm aware all compiling errors need fixed before code files can load or you even add new scripts to objects but if I'm being told I have none in the console then why do my objects with the scripts attached that aren't loading, telling me I need to fix compile errors that don't exist?

    First thing I can think of is the whole deprecation of GUILayer, GUITexture etc. as my project relied on them heavily and I had tons of in level objects that used GUITexture and I would do things within scripts to enable and disable them. I see that when I load a level in the editor, Unity says it is removing those references from the objects using GUILayer and GUITexture. I'm also aware about changing GUITexture to Image as well as using UnityEngine.UI which I have done. (part of fixing any code errors) These things only give me yellow warnings in the editor, but no code compiling errors.

    What is causing my scripts to not load? Scripts aren't loading from my created scripts, Probuilder scripts etc. Nothing will load the scripts?

    Any solutions? Jumping from 2018 to 2021 is turning out to be a real headache and I'm not sure if I want to even deal with it at this point since it was so easy to just add a GUILayer to a camera and a GUITexture to an object and it worked fast and easy.

    EDIT: Actually I found this code error when using the Safe Mode.

    Library\PackageCache\com.unity.collab-proxy@1.5.7\Editor\Collaborate\UserInterface\WindowCache.cs(108,80): error CS1729: 'SerializableDictionary<string, bool>' does not contain a constructor that takes 1 arguments

    How do I fix this? I haven't a clue what that relates to. I even tried deleting this folder from the Library and the next time I load Unity, it rebuilds that folder, with that file and gives the same error.
     
    Last edited: Jun 25, 2021
  2. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,903
    Potential fix: go back into safe mode uninstall the collaborate package through package manager.
     
  3. JWdell

    JWdell

    Joined:
    Oct 24, 2014
    Posts:
    54
    I don't see anything named that. Would it be under something else? I checked everything. Packages: In Project, Unity Registry, Assets and Built In.
     
  4. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,903
    collaborate or version control is under the
    'in project'
     
  5. JWdell

    JWdell

    Joined:
    Oct 24, 2014
    Posts:
    54
    Yeah it was Version Control. Deleted that and now that code error is gone. Unfortunately, that code error was the least of my problems. There is too much a difference jumping from 2018 to 2021 as it breaks pretty much everything in my project and no way I'm going to spend the next year trying to rebuild this project using different techniques. Seems developer unfriendly and backwards to constantly change things. Everything in Probuilder is completely broken. Materials, scripts etc. all because it seems things are moved or renamed for whatever reason. Can't even test a level anymore if you have a single variable unassigned. Can't be bothered to reassigned hundreds of variables I had to rename from GUITexture to Image just to test a level now. A lot more than that to mention but I guess I'll leave it at that and cut my losses. New Unity versions aren't for me.

    Thanks for you helps though.
     
    vargata likes this.
  6. vargata

    vargata

    Joined:
    Nov 26, 2013
    Posts:
    120
    yep, shame they cant bother for a proper upgrading system. I gave up too to update unity, dont even mention the latest ones are getting less and less intuitive :(
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,710
    There's some notes about this:

    http://www.procore3d.com/forum/topic/1136-what-is-the-correct-way-to-update-probuilder/

    There are likely only a few things that need fixing. Source: I do this all the time, both keeping my old indie games alive and professionally. The main issue you will have is external third party crud, but almost all the Unity stuff should just work. There may be issues with Blender files, but they are totally solveable too:

    Blender3D import FBX:

    https://forum.unity.com/threads/from-blender-to-unity-problem.1073381/#post-6925811

    The script that Unity uses:

    ./Hub/Editor/2020.2.1f1/Unity.app/Contents/Tools/Unity-BlenderToFBX.py


    More on fixing it:

    https://forum.unity.com/threads/all-my-mesh-folder-content-is-gone.1102144/#post-7094962

    Blender3D objects used as trees / detail in Unity3D terrain (See the second half of this response)

    https://forum.unity.com/threads/ter...trees-made-with-blender.1112119/#post-7155631
     
  8. JWdell

    JWdell

    Joined:
    Oct 24, 2014
    Posts:
    54
    I don't use blender for anything. My main problem is Probuilder renamed scripts and uses a new way of creating objects so it basically broke everything I built. I used a lot of GUILayer/GUITexture items which now need shoved into a Canvas so all of that needs completely rebuilt from scratch and a lot of code rewrite to juggle multiple Canvas/Eventsystem's in order for everything to work as it did. Having to rename thousands of variable references to GUITexture to Image breaks all the connections so you have to sit there and reconnect everything. It doesn't help either that when GUITexture is completely removed, you can't see what objects did use GUITexture so that you can replace them with RawImage. Like I said, too many changes and I just can't afford financially to rework more than 60% of my project. I think I'm just at the point after several years of using Unity that I've had to rework so many things on a project due to changes. It is frustrating and I just don't want to use Unity anymore.
     
  9. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,710
    It's your project, but personally I would make a college try at it... you've already done the JS -> C# stuff, now start plucking parts of your UI out and making them into canvases... put each UI chunk in a separate scene and load it additively, having it refer to wherever you keep your global-ish variables.

    Remember life is all about framing: if you frame this as the worst thing that has ever happened in the world, you're unlikely to be motivated to fix anything. If instead you frame it as "I can chip away at this a bit each day, soon it will be done," you can give it a shot.

    I would leave the project in 2018 and dive into removing the need for deprecated stuff. The good news is you can make the project better, cleaner, etc. all at the same time. Source: again, I do it all the time to my old code. My KurtMaster2D game contains code dating all the way back to 1984, games I wrote in high school. I'm so glad I kept them alive.

    PS: I assume you're using source control? Personally I use git because it is free and there are tons of tutorials out there to help you set it up.

    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

    Here's 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 the right .gitignore file:

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

    Generally setting Unity up (includes above .gitignore concepts):

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

    JWdell

    Joined:
    Oct 24, 2014
    Posts:
    54
    Is there any documentation on what version GUITexture was completely removed? I seriously don't want to use the UI system to recreate an entire games worth of menu's. It isn't a good workflow at all, more time consuming and uses functions I don't need to use. I can't say that's more efficient than a single GUILayer on a camera and a single GUITexture on an item that all you needed to do was adjust the transform size and it worked flawlessly and no performance issues.

    EDIT: Nevermind, it was 2019.3 which I can't use either.
     
    Last edited: Jun 26, 2021
  11. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,710
    I will grant you the new workflow is more work for a single engineer.

    But Unity is intended for use by a team.

    What this means is that Mr Engineer (that's me!) makes the UI out of white boxes and texts, then hands it off to a team of artists who proceed to go nuts anchoring, decorating, spiffing it all up.

    Meanwhile Mr Engineer (that's me!) never changes the UI code again. I got games to write man, not UI!

    The old workflow where Mr Engineer has to be called over when something doesn't quite align with something else is dead, thank goodness. That's not engineering, that's noodling. Let the artists learn how to use anchors and alignment and let them animate and twiddle and fiddle all that crap... I'm not touching my code anymore; it's done.

    But... since I started out exactly the way you did, noodling my UI pixel by pixel, and since many of my games still use GUI stuff, I have taken a few moments to get you started with an example of just how easy it would be to write your own GUIText and GUITexture classes that do just what you need and replace them in your prefabs.

    Screen Shot 2021-06-26 at 10.11.21 AM.png

    If you're interested, here's the repo:

    https://github.com/kurtdekker/kurtgui

    There's links in the readme for how to potentially mass-replace all instances of GUIText with KurtGUIText but I haven't tested it extensively. Some members might not map over and require fixup. But at least it gets you about 80% started I would estimate, depending on how crazy your UI is.
     
    Last edited: Jun 26, 2021
  12. JWdell

    JWdell

    Joined:
    Oct 24, 2014
    Posts:
    54
    I never use GUIText for anything. I only used GUILayer on the camera and tons of GUITextures with a piece of code that retains any aspect ratios I needed. My entire HUD, Inventory System and damage overlays relied heavily on GUITexture. I don't use Prefabs for any menu related stuff either. I can't really test anything either until I redo all the connections Unity broke having to rename all the GUITexture variables. Terrible idea to stop a developer from testing other things until any and all unconnected variables have been reassigned. This never used to be the case. I'm aware these variables aren't connected. I want to work on something else for now and eventually get back to the variables but nope, I have to do the new workflow they are forcing. Terrible!
     
  13. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,710
    I'm sorry, I've never met such a defeatist.

    I wish you the best in life. Good luck with your project.
     
  14. vargata

    vargata

    Joined:
    Nov 26, 2013
    Posts:
    120
    BUT! why are you updating mid project? I've done it once and then went back to what i started with. its not worth the mess they are creating with every update. thing is their developers are getting paid to create new things so they keep creating new things even if its not any useful or does not offer any better than the old one. That's how paid jobs work and why many of us rather works as freelancers. Just remove the new version, return to your original one and keep working on that, instead of remaking the entire project
     
  15. JWdell

    JWdell

    Joined:
    Oct 24, 2014
    Posts:
    54
    I'm not updating mid project. This project was released already using Javascript with GUILayer / GUITexture. It is just that if you want to move forward and bring your project to other platforms (console for example) you have to update Unity and deal with all the changes. Obviously, if updating Unity, I had to rewrite the game in C#. Not so bad, only took 2 weeks. I just don't like the workflow current Unity has and some of the decisions they made which are not helpful nor developer friendly. Even though I don't like it, I can work through the changes and redo menu's, functionality etc. because of being forced to shove everything in a canvas now. Now if I can get some responses on how to fix ProBuilder that changed completely since version 3.0.9 I can be on my way and move forward. Until I have a fix for ProBuilder, I'm at a halt. Upgrading has never been a straight forward and simple process since I've been using Unity. Something always gets broken and hard to get information on how to fix what got broke. Again, something else that is not developer friendly.
     
    Last edited: Jun 27, 2021
  16. JWdell

    JWdell

    Joined:
    Oct 24, 2014
    Posts:
    54
    Well time is money so as long as Unity keeps breaking people's projects, it keeps costing people money to fix them.

    I'm fine with rewriting code. I'm fine with redoing menu's etc. even though it will cost me financially since I'm not a hobby developer. What I'm not fine with is, being forced to upgrade and the result of upgrading, breaks my entire projects and zero information on how to fix or upgrade without having your projects broken. You would think simply upgrading would be a non-hassle process but with Unity, that is not the case nor has it ever been.