RenderMode.DrawMeshNow error

edited December 2023 in Help
Hi there, it's me again! :)

I uploaded a first version of my app for my testers and noticed in my exception logging that apparently an error is thrown without doing any harm. At least that's what I can see when testing.
Live2D Cubism 2.1 / RenderMode.DrawMeshNow Error live2dmodel.draw() must be called in OnPostRender() or OnRenderObject() . ------------------- 
  at live2d.     :drawLast()
I used the newest code from the Unity sample app provided with the SDK.

Comments

  • Yeah, this error basically tells you that ALive2DModel.draw() shouldn't be called from MonoBehaviour.Update() when you use RenderMode.DrawMeshNow. Could you recheck that the script for drawing the model calls ALive2DModel.draw() in MonoBehaviour.OnRenderObject() like this:
    private void OnRenderObject()
    {
        if (live2DModel == null) { return; }
    
    
        live2DModel.draw();
    }
  • edited June 2016
    The code in LAppModelProxy looks like this:
    
    void OnRenderObject()
    {
    	if(!isVisible) return;
    	if(model==null)return;
    
            if(model.GetLive2DModelUnity().getRenderMode() == Live2D.L2D_RENDER_DRAW_MESH_NOW)
    	{
                model.Draw();
    	}
    		
    	if (LAppDefine.DEBUG_DRAW_HIT_AREA)
    	{
    		model.DrawHitArea();
    	}
    }
    
    void Update()
    {
    	if(!isVisible) return;
            if (model == null) return;
    
            model.Update();
            if (model.GetLive2DModelUnity().getRenderMode() == Live2D.L2D_RENDER_DRAW_MESH)
            {
                model.Draw();
            }
    }
    
  • Which is correct :# . So you should be on the safe side :D .
  • So I can ignore that exception?
    It's a little bit weird to do so... :D
Sign In or Register to comment.