Hello,
I am trying to destroy RenderTexture, but I’m getting an
Destroying object “Ceto Wave Spectrum GPU Buffer” is not allowed at this time.
Any idea what does it mean? When is it “not allowed time”?
Thank you
Hello,
I am trying to destroy RenderTexture, but I’m getting an
Destroying object “Ceto Wave Spectrum GPU Buffer” is not allowed at this time.
Any idea what does it mean? When is it “not allowed time”?
Thank you
You need to post your code so that we can make an idea of what’s happening. Please use code tags: Using code tags properly
It’s literally just the destruction of RenderTextures
texList[i].Release();
UnityEngine.Object.Destroy(texList[i]);
where texList is list of RenderTextures. I’m not sure what more context to give you, as the error is not saying much and I have no idea what can it even be caused by.
It does not matter when is it destroyed (Update, OnDisable, OnDestroy). If you can tell me when can this error fire, I will be able to check it on my side.
Hmmm I don’t think I’ve ever needed to call Object.Destroy(…) on a RenderTexture. I figured renderTexture.Release() was enough, but do correct me if I’m wrong.
Did you try DestroyImmediate?
The RenderTexture as configured by that package may be different than other render textures. I’m not sure you should be manually destroying that. Did you talk to the package author about this?
Also I’m not sure if you should be calling Destroy after Release. Both may defer releasing actual resources, so maybe what Destroy is telling you is that the texture is already scheduled to be released.
DestroyImmediate had same effect.
@doctorpangloss It’s normal Unity’s RenderTexture. I was thinking about Destroy as well, I can’t see anywhere in the manual mentioned whether they should/can be destroyed or whether just releasing them is enough. This is a 3rd party code (CETO), so I believe they had a reason to do both. I sure hope so.
Hi @tfgrip . I"m having the same problem with CETO. Any news?
None, we’re just ignoring it and hoping for the best ¯_(ツ)_/¯
I have the same situation,Occurs when debugging is turned off。
i GameObject.DestroyImmediate RenderTexture)
get this error
Destroying object “TempBuffer 677 1920x1080” is not allowed at this time.
I have solved this problem:
Destroying object “TempBuffer 677 1920x1080” is not allowed at this time. when do Destory the RenderTexture by Object.DestroyImmediate or Object.Destroy;
Here is the solution:
I play movie to ugui view,use VideoPlayer , RenderTexture _rt, UnityEngine.UI.RawImage;
so when i destory RenderTexture,
first clear RawImage.texture and VideoPlayer.targetTexture
second clear RenderTexture.active :
if (RenderTexture.active == _rt)
RenderTexture.active = null;
finally
Object.DestroyImmediate(_rt);
RenderTexture _rt = this.m_rtex;
this.m_rtex = null;
if (null != this.m_vper)
this.m_vper.targetTexture = null;
if (null != this.m_rawImg)
this.m_rawImg.texture = null;
if(null != _rt)
{
if (RenderTexture.active == _rt)
RenderTexture.active = null;
_rt.Release();
GameObject.DestroyImmediate(_rt);
}
You need release m_enabledData reference.
like this:
var RTsElement = m_enabledData.GetEnumerator();
while (RTsElement.MoveNext())
{
var RTs = RTsElement.Current;
if (RTs == null)
continue;
for (int index = 0; index<RTs.Length; ++index)
RTs[index] = null;
}
RTsElement.Dispose();
m_enabledData.Clear();