Unity服务器构建(无头)本机纹理指针返回0

问题描述 投票:0回答:1

[当我在Unity Editor中运行以下代码时,或者如果我构建并运行它(不是在无头模式下运行),GetNativeTexturePtr()将返回纹理ID的值>0,等等

但是,在构建启用了[[Server Build]选项的应用程序时,GetNativeTexturePtr()始终返回0。即使IsCreated()返回true。

任何想法在这里发生了什么?

using System.Collections; using System.Collections.Generic; using UnityEngine; public class test : MonoBehaviour { private RenderTexture m_RenderTexture; // Start is called before the first frame update void Start() { m_RenderTexture = new RenderTexture(256, 256, 24, RenderTextureFormat.ARGB32); m_RenderTexture.Create(); if (!m_RenderTexture.IsCreated()) { Debug.LogError("RenderTexture could not be created"); } Debug.Log("texture id = " + m_RenderTexture.GetNativeTexturePtr().ToString()); } }

统一版本2019.1.9f1
unity3d rendering textures render-to-texture
1个回答
0
投票
摘自Unity文档GetNativeTexturePtr article
© www.soinside.com 2019 - 2024. All rights reserved.