Search Unity

Question I'm desperate, refactoring don't work as expected, no clues, no error message!

Discussion in 'Scripting' started by neoshaman, Mar 12, 2022.

  1. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    I'm working a potato Global Illumination (radiosity) method.
    I made a first version of the code as prototype to shop around unity's function, to know how to do it in unity, carefully reading manual, scripting reference, research paper, open source code, ie doing extensive research to make sure I do it right. It worked as expected, i code it up to generating occlusion data.



    But the code was being too spaghetti with failed implementation and overlapping responsibility, so now I figure out what works and what didn't, I decided to refactor it to future proof it, and implement the last bit about the GI resolution. I would expect for that part to be one which would have broken, so needed iterations to make perfect.

    Except not at all, I'm getting stuck way before any of that matter, and in the most curious way.

    When I run the code i get a blue screen, which should be the texture generation camera, but I don't know why it doesn't render the main camera for the scene like it did with the previous code.


    Worse the prefab "blew up" by losing its material afterwise, and I don't know why, there is error code that is fired.


    I double checks for nulls, I even created a debug primitive to checked for material assignement as this part of the code seems to create the blowing up:

    Code (csharp):
    1.  
    2.         Material dmat  =new Material(shader.debugshader);
    3.        root.GetComponent<Renderer>().material = dmat;
    4.  
    5.  
    Which doesn't seems to do anything illegal. I thought it might be scope problem, but i'm unable to confirm this.

    I have been double checking for days already I still don't get it, and has no clue where to proceed.

    I shared code here:
    https://forum.unity.com/threads/ass...t-blow-up-the-project-after-playmode.1250791/

    And the main thread where I reported my progress in the GI is there:
    https://forum.unity.com/threads/exp...n-for-open-gl-es-2-0-and-weak-machine.752600/
     
  2. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Also if someone know a way how to best formulate the problem to find proper help... I'm in a panicked state since a few days already, I don't know if I express the issue correctly.
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    I'm assuming this means you are not using source control so you can instantly revert?

    One way to solve an issue like this is to start rebuilding the parts and trying to identify where things are going wrong. We know that all the parts SHOULD work, so you have to painstakingly prove you are still doing everything necessary to make them work. One way is to rebuild a small example of what you're attempting in a separate scene and prove you are doing everything right without the clutter of the rest of your game.

    That way, only two possible results happen:

    1. you figure out how to make it work, you apply the knowledge back to your main game, even if that means rebuilding something from ground up

    2. you realize that something really does NOT work, and now you have a tiny scene that proves it, and you can even file bug reports with a small project scene like that.

    I'm sorry you've had this issue. 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

    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 an appropriate .gitignore file for Unity3D:

    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

    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.

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

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    I use source control, i also have a duplicate on my drive, and the old code si still in the project! And I have it on a hard drive too... I didn't lost the old code : https://github.com/Neoshaman/Mapping-Approximation-of-Global-Illumination-Compute

    I kind of already done all permutations I could, and run out of idea, I always ask as a last resorts, which generally mean nobody else would probably know and I stumbled on a new thing. I don't even know what else I can do, because I did it all. For example the debug mesh does work properly, but the scene mesh do not, another scene work with the old code, but not the new code, so what remain is that unity isn't liking this very specific combination of stuff, which everything else was move around already, I rebuild the mesh, same things. I'm so puzzled it's like unity had a mind of its own and said denied.

    So it's probably something I don't know nor understood properly about unity, but I already not only perused bug report, forum post, manual, scripting reference, googling like mad, there is nothing even remotely similar, what else can i do?

    I just don't get it. I'm bashing my head so hard, I have already spent months on this! And it's not even a problem that make sense.

    Though I have issue with source control too, especially with visual code, I updated it manually on github, although that's not the problem I'm here for:

    upload_2022-3-12_18-49-14.png

    This has been in this state since 10h this morning, it's 18h now, I don't know what's going on or how to diagnose it, or even present that problem too. I'm below poverty line so I can't pay anyone either, and that was a way to show I could do something, so I'm not getting paid either. And i'm in somewhere geographically isolated so it's not like I can network and find mentor or peer. This is such a failure on all fronts, i'm truly in despair.

    Nothing is working out in the strangest way, and i'm panicked because any self diagnosed run out of ideas.