Download

How to set the Build.cs file for use slate?

Hi
I am use Xcode and engine version 4.7.
When i add a Slate Widget to my game, it’s compiled with errors and can’t hot load, I find the unreal document said that i need to set up the Slate module dependencies, bellow is what i set in my build.cs file:


// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class VehicleTest : ModuleRules
{
	public VehicleTest(TargetInfo Target)
	{
		PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay" });
	}
    PrivateDependencyModuleNames.AddRange(new string] { "Slate", "SlateCore" });
}


after doing this i still can’t make the compile works, so i want to know where I should add the line for set up the Slate module dependencies, or what is the right
layout? Thank you!

Hey add UMG, Slate and SlateCore to the Public Dependency Module Names, like so.


PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "UMG", "Slate", "SlateCore"});

Also here are some headers I found is nice to add to YourProjectName.h


"Runtime/UMG/Public/UMG.h"
"Runtime/UMG/Public/Blueprint/WidgetBlueprintLibrary.h"

Edit: Same apply if you only want Slate after reading OP a second time, you can then just remove the UMG module and change headers for what you need.

Hope it helps!
WCode

Thank you WCode,
After doing what you said, my code can compile with no error, it’s works!

Great to hear happy coding! :slight_smile: