UE4开发常见问题:导入插件、代码调试、格式异常

一、如何导入其他源代码插件

1、新建空插件,名字与要导入的插件相同

2、复制旧插件源代码到新插件Source目录

3、vs工程中添加旧插件的.h .cpp文件

4、修改 插件.build.cs代码,添加旧插件需要的库。

二、如何进行vs源代码插件调试

1、首先打开UE4工程。

2、必须在UE4中选择菜单“文件”->打开vs工程,否则vs启动调试运行会报错。

3、关闭原工程,VS中开启调试运行

三、PF_R8G8B8A8 不支持的格式

Assertion failed: FTextureRenderTargetResource::IsSupportedFormat(InOverrideFormat) [File:D:\Build\++UE4+Release-4.16+Compile\Sync\Engine\Source\Runtime\Engine\Private\TextureRenderTarget2D.cpp] [Line: 84] 

void UTextureRenderTarget2D::InitCustomFormat( uint32 InSizeX, uint32 InSizeY, EPixelFormat InOverrideFormat, bool bInForceLinearGamma )
{
	check(InSizeX > 0 && InSizeY > 0);
	check(FTextureRenderTargetResource::IsSupportedFormat(InOverrideFormat));

	// set required size/format
	SizeX = InSizeX;
	SizeY = InSizeY;
	OverrideFormat = InOverrideFormat;
	bForceLinearGamma = bInForceLinearGamma;

	// Recreate the texture's resource.
	UpdateResource();
}

/**

 * Return true if a render target of the given format is allowed

 * for creation

 */

bool FTextureRenderTargetResource::IsSupportedFormat( EPixelFormat Format )

{

    switch( Format )

    {

    case PF_B8G8R8A8:

    case PF_A16B16G16R16:

    case PF_FloatRGB:

    case PF_FloatRGBA: // for exporting materials to .obj/.mtl

    case PF_A2B10G10R10: //Pixel inspector for normal buffer

    case PF_DepthStencil: //Pixel inspector for depth and stencil buffer

        return true;

    default:

        return false;

    }

}

四、UE4新建C++类后提示generated.h冲突,不能产生代码
CompilerResultsLog: ERROR:  Changes to generated code are not allowed - conflicts written to generated.h.conflict

关闭编辑器,vs,重新打开。并确保Visual Studio中的解决方案配置为Development Editor

猜你喜欢

转载自blog.csdn.net/a2831942318/article/details/127430373
今日推荐