Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Ah hm, maybe something with the upgrade doesn't fully work since it's a change to metadata... could you delete the icon & its metadata file and try re-importing STM?

I tried deleting the entire asset and re-importing it, but the problem still didn't work out

Hey, replying to you here since it's a duplicate issue.


https://pastebin.com/0M2kf8D6 Here is the script I wrote that fixed the issue on my end, and what I did to the file before publishing. If you run this script on the same file, does the issue still persist? If so, I need to dig deeper as to why me running this code didn't fix it for everyone else, and if not... well I guess it's back to the drawing board. Sorry for the trouble! It seems that a few other assets have been effected by this type of error, too... If all else fails, it's just a bad .png file that can be deleted and everything else will work fine.

Thanks, I'll try this code. I do not know how this Bug is triggered, it may take some time to test.

Put that code on any gameobject, drag in the files causing the error into the field, click the gear icon in the top-right of the component and select "Fix" from the dropdown menu!

(1 edit)

Hi, I did it according to the method you gave, but this problem still occurred.

Is it because there's some code will set this image to DontSave during runtime? Because if I reopen the project and build it directly, I don't get this bug , but if I run the program, I might get this problem

This problem has been reported for a while and as far as I can tell, I can't seem to find any code that would change the hideflags of the file whatsoever, so I thought the script to manually change the hideflags would solve it for good... Hm... maybe because the file is an icon to a script, that script could be having a hideflag applied to it and that's passed on to the icon somehow...? I do have some code within STM that changes the hideflags of the meshfilter and meshrenderer components, but I can't see how it's related to the icon... I'll be able to take another close look at this soon, sorry for the delays. But this really is a strange problem that's been bigger than it has any right to be. This is very good information though, if it's something happening just during editor runtime, that narrows down where the problem is.


If you want to test something for me, within the file "SuperTextMesh.cs" there's a method named "HideInspectorStuff". if you remove everything within that method, does the problem still occur? This is the part of the code that sets the meshfilter and meshrenderer hideflags I mentioned. I haven't been able to reproduce the bug in a while so that would be a huge help!

(3 edits)

I tried to remove the code in HideInspectorStuff(), but the bug is still occur.

And I found out how the bug triggers, I don't know if this will help you:

 This problem may caused by inspector. When I open STM's inspector, the image is immediately set to HideFlags.HideAndDontSave.

Then if I use the Fix() method you provided earlier, it will be fixed, and later when I open the inspector, bug will not trigger.

BUT, if any of my code changes and a Unity recompile the code, when I open STM's inspector again, the image will be set to DontSave again.

In summary, bugs are triggered when the STM inspector is first time opened after the  Unity Editor is opened and code is recompiled, which may be related to some initialization event.

I searched all the code about STM, and there is no code related to hideflag except HideInspectorStuff(), but HideInspectorStuff() is not the cause of the problem, so this may be a bug in the Unity Editor?

That's all I know so far, below is the code I used for the test.

using UnityEngine;

[ExecuteAlways]

public class TestCode : MonoBehaviour

{

   [SerializeField] Texture m_texture;

    public void Update()

    {

        if (m_texture.hideFlags == HideFlags.HideAndDontSave) {

            Debug.Log("Error");

        }

    }

    [ContextMenu("Fix")]

    public void Fix()

    {

        m_texture.hideFlags = HideFlags.None;

    }

}

Hmm, I'd believe it being a Unity bug, because without HideInspectorStuff(), there's no call to HideFlags whatsoever... I may just have to hard-code it so that whenever Unity tries to make a build (onpreprocessbuild?), the Fix() code is called...?


I'll take one more look soon before resorting to that method though, the fact it may be related to an initialization even will help! Thank you so much for your patience and help!!

Ok, I think I've finally got a proper fix for this. Will be publishing an update shortly! The error seemed to be: I had those icons set as textures used by quads to show certain buttons to press in sample scenes, but as icons assigned to scripts/unity UI elements, that seemed to cause some kind of conflict.