Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Wanwu

18
Posts
3
Topics
1
Following
A member registered Apr 16, 2022

Recent community posts

Yes, the program works normally, except that every time a warning pops up, I added "new" in front of the function and problem solved

(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;

    }

}

(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

(1 edit)

Hi, get a warning log:

Assets\Clavian\SuperTextMesh\Scripts\Modules\STMAutoDelayData.cs(36,14): warning CS0108: 'STMAutoDelayData.DrawCustomInspector(SuperTextMesh)' hides inherited member 'STMDelayData.DrawCustomInspector(SuperTextMesh)'. Use the new keyword if hiding was intended.

should I use "public new void DrawCustomInspector" instead "public void DrawCustomInspector"

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

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

I just emailed you and thank you so much for your help.

(2 edits)

There are the setting of stm and  the code I used for my tests, maybe this information will be useful to you.

using System.Collections;

using UnityEngine;

public class Test : MonoBehaviour

{

    public SuperTextMesh superTextMesh;

    private void Awake()

    {

        superTextMesh.gameObject.SetActive(false);//the superTextMesh is hide when game is start.

        superTextMesh.readDelay = 0.01f;//read delay >0

        superTextMesh.autoRead = false; //auto read set false, I will call auto read later

    }

    //add it to buttons

    public void AddToButton1()

    {

        StartCoroutine(TestCode1());

    } public void AddToButton2()

    {

        StartCoroutine(TestCode2());

    } public void AddToButton3()

    {

        StartCoroutine(TestCode3());

    }

    //set stm gameobject active and call read immediately.

    public IEnumerator TestCode1()

    {

        superTextMesh.gameObject.SetActive(true);

        superTextMesh.Read();

        Debug.Log(superTextMesh.reading);//true

        yield return null;

        Debug.Log(superTextMesh.reading);//false

        yield return null;

        Debug.Log(superTextMesh.reading);//false

        yield return null;

        Debug.Log(superTextMesh.reading);//false

    }

    //set stm gameobject active and call read after one frame.

    public IEnumerator TestCode2()

    {

        superTextMesh.gameObject.SetActive(true);

        yield return null;

        superTextMesh.Read();

        Debug.Log(superTextMesh.reading);//false

        yield return null;

        Debug.Log(superTextMesh.reading);//false

        yield return null;

        Debug.Log(superTextMesh.reading);//false

    }

    //set stm gameobject active and call read after two frame.

    public IEnumerator TestCode3()

    {

        superTextMesh.gameObject.SetActive(true); 

        yield return null;

        yield return null;

        superTextMesh.Read();

        Debug.Log(superTextMesh.reading);//false

        yield return null;

        Debug.Log(superTextMesh.reading);//false

    }

}

(4 edits)

Unity 2020.3.33f1c2 and I used Unity UI for test(stm is inside Canvas). I have tried 3D stm, and the result is same.

(3 edits)

Sorry, but it still doesn't work. I still need wait 2 frame after super text mesh activates to use Read(), otherwise, when I use Read() the entire text will show immediately without reading process.

And if I set auto read to true, skip to end  and currentReadTime will still not work if super text mesh is just active. (I need use yield return null to wait one frame after super text mesh is active).

(4 edits)

  Here is another test about auto Read. Auto read works normal, but sometimes I need to set the start position.here is a test about currentReadTime(set Remember Read Position to true or false will get same result)

    public IEnumerator TestCode4()

    {

        superTextMesh.gameObject.SetActive(true);

        superTextMesh.currentReadTime = 10;// not work, Read position not change

    }

    public IEnumerator TestCode5()

    {

        superTextMesh.gameObject.SetActive(true);

 yield return null;

        //superTextMesh.currentReadTime = 20;// it works, read Position change to 20

    }


set currentReadTime immediately after gameobject set active will not change the read position. The same problem happens on SkipToEnd() too.

(5 edits)

I ran some more tests about Read() (auto read is false, super text mesh is disabled at the beginning):

 public IEnumerator TestCode1()

    {

        superTextMesh.gameObject.SetActive(true);

        superTextMesh.Read();

        Debug.Log(superTextMesh.reading);  //true

        yield return null;

        Debug.Log(superTextMesh.reading);  //false(Read() is blocked there)

        yield return null;

        Debug.Log(superTextMesh.reading);  //false

    }

        public IEnumerator TestCode2()

    {

        superTextMesh.gameObject.SetActive(true);

        yield return null;

        superTextMesh.Read();

        Debug.Log(superTextMesh.reading);  //true

        yield return null;

        Debug.Log(superTextMesh.reading);  //false(Read() is blocked there)

        yield return null;

        Debug.Log(superTextMesh.reading);//false

    }

    public IEnumerator TestCode3() //Read() works in this case

    {

        superTextMesh.gameObject.SetActive(true);

        yield return null;

        yield return null;

        superTextMesh.Read();

        Debug.Log(superTextMesh.reading); //true

        yield return null;

        Debug.Log(superTextMesh.reading); //true(Read() keep working later)

    }

I needed to wait at least two frames after super text mesh was activated to execute Read(), otherwise the code would not work.

(3 edits)

Hi I found that Read function doesn't work in some cases, I'm not sure if it's a bug.

1. if Read Function is in Awake or Start

2. if gameobject is disabled and execute following code

         superTextMesh.gameObject.SetActive(true);

        superTextMesh.Read();


Read() seems to be blocked by some other code.



Hi, I find the solution. I can set anchor to CenterRight and Alignment to Right to get the result I want. Thank you so much.

(4 edits)

Thanks for you reply, I tried "Content Size Fitter", But it's still not I wan’t. "Content Size Fitter" will set the width of rect transform same as the width of texts, so the center of text will always stay that center of rect transform. the bottem one(Unity text) is the effect I want. 

(2 edits)

Hi, I'm confused about "UI Wrap".If I set UI Wrap false, then the size of a text can be out of the range of the rect Transform( that's what I want). But if the horizontal text is out the of range, then the alignment mode will always be Left.(text start at left side of rect transform, even though I set alignment to center or right. Are there any way to fix it?

Here is the unity text, if I set herizontal Overflow to Overflow, the start point of text will still follow alignment.