How Add Custom C++ Classes to List of Blueprintable Classes in Beta6?

Dear Friends at Epic,

I am trying to reconstruct my NoDeleteMe0 move component crash.

I made a new Third Person C++ project in beta6.

I made my custom player controller class

I can compile the code.

But when I go into editor and try to make a blueprint of my custom class, MyProjectPC is not showing up in the list!

This does not happen to me using my own project which was started in Beta4.

Any ideas?

Thanks!

PS: this new beta6 project is using the no Class, or Private, or Public directory setup, which I can’t say I am a fan of and I hope you always maintain support for Classes,Private,Public, it helps me keep myself organized when I have a ton of classes as I do :slight_smile:

// Copyright 1998-2013 Epic Games, Inc. All Rights Reserved.
#pragma once

#include "MyProjectPC.generated.h"

UCLASS()
class AMyProjectPC: public APlayerController
{
	GENERATED_UCLASS_BODY()

	UFUNCTION(BlueprintCallable, Category=ActorDeleteTest)
	void DeleteAllCharacters();
	
	void VDestroy(UObject * ToDestroy);
};

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

#include "MyProject.h"
#include "MyProjectPC.h"

//////////////////////////////////////////////////////////////////////////
// AMyProjectCharacter

AMyProjectPC::AMyProjectPC(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	
}

void AMyProjectPC::DeleteAllCharacters()
{
	APawn* PlayerPawn = GetPawn();
	for(TActorIterator< ACharacter > Itr(GetWorld()); Itr; ++Itr)
	{
		if(PlayerPawn == *Itr) continue; //skip player
		
		//delete all other actors
		VDestroy(*Itr);
	}
}
void AMyProjectPC::VDestroy(UObject * ToDestroy)
{
	if (!ToDestroy) return;
	if (!ToDestroy->IsValidLowLevel()) return;
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	
	//Actor?
	AActor * AnActor = Cast(ToDestroy);
	if (AnActor)
	{
		//AnActor->MarkPendingKill();
		AnActor->K2_DestroyActor();
		//AnActor->Destroy();
		ToDestroy = NULL;
	}
	
	//Object - BeginDestroy
	else
	{
		//Begin Destroy
		ToDestroy->ConditionalBeginDestroy();
		ToDestroy = NULL;
	}
	
	//GC
	GetWorld()->ForceGarbageCollection(true);
	//	* pant * too many crashes * pant *
}

Hey , don’t you need to add (Abstract, Blueprintable) into the Parenthesis next to UCLASS in the header file?

I’m kind of asking rather than telling since I figure you’d already know that :stuck_out_tongue:

Nice to hear from you!

I tried both

UCLASS(Abstract,Blueprintable)
class AMyProjectPC: public APlayerController
{
	GENERATED_UCLASS_BODY()

	UFUNCTION(BlueprintCallable, Category=ActorDeleteTest)
	void DeleteAllCharacters();
	
	void VDestroy(UObject * ToDestroy);
};

and

UCLASS(Blueprintable)
class AMyProjectPC: public APlayerController
{
	GENERATED_UCLASS_BODY()

	UFUNCTION(BlueprintCallable, Category=ActorDeleteTest)
	void DeleteAllCharacters();
	
	void VDestroy(UObject * ToDestroy);
};

but still the class does not show up when trying to make blueprint of a custom class

:slight_smile:

Hi ,

Thank you for your feedback. This is something we are aware of and a feature request has been entered into our database. Our developers have assessed and prioritized the report. If there is anything else that will improve workflow, please let us know.

Thanks!
-W

Thank You Wes!

#:heart:

#just another follow up on this,

here is another case of someone losing many hours to the issue of the Editor icon not using -debug vs the VS always defaulting to debug.


Another case of lost time due to the inconsistency
https://rocket.unrealengine.com/questions/16176/bug-disappearing-uproperty-in-the-editor.html


I am glad this is being addressed,

just adding more info to show how important it is that the default VS build configuration be Development_Editor /

the editor icon and VS always matching by default.

#Summary

Just switch default in Visual Studio to Development Editor for when project files are generated and all of this lost time should be alleviated

:slight_smile:

Hey ,

This should still work the same way in beta6. If you create a Basic C++ project, it will provide you with a pre-created GameMode and PlayerController class. They can be blueprinted in-editor with no modification of the code base.

I also created a Third Person C++ project like you did and manually added a PlayerController class, and I could still blueprint it in-editor.

I checked your provided code and it all seems legit. Adding Blueprintable to the UCLASS attributes shouldn’t be necessary, as it should inherit it APlayerController.

Most likely your problem is caused by one of two things:

  1. You have some other classes in your project causing some kind of bug that is hiding this one (and possibly others). Unlikely, but possible. I have had classes not show up in the class list, though usually it is either all or nothing visible, not just the one (and it was always caused by running a previous build of the project after a failed compile). How many classes are in this project, and are any of them ‘out of the ordinary’?
  2. Your directory structure is causing problems. How are your files laid out? Do you have any folders you are putting your code into besides the root?

Those are both shots in the dark. It is indeed a confusing problem. If neither of those are the faults (and I don’t think they area), I would suggest creating a new project (Basic C++ preferably) and starting from a point where you know it is blueprintable.

Thanks for taking the time Andrew!

“I would suggest creating a new project (Basic C++ preferably) and starting from a point where you know it is blueprintable.”

I had only juuuust started this project!

Just to do a separate proof of a crash I was having in my beta4 project

it is entirely a bare bones unmodified project except my added PlayerController subclass.

That is why this issue is so puzzling / disconcerting

It is literally bare brand new project!

All directory and file structures are just as UE4 creates then in Beta6

#That Debug Default in VS

Nevermind, it was the fact that VS defaults to Debug build, which the editor never USES

I really think Epic should fix this

why would you default VS to compiling something the Editor shortcut never uses?

PS: Epic please acknowledge my request to change the format for beginners to c++ to avoid this issue, I’ve requested this priorly.

Please consider making it so that VS defaults to Development_Editor so that someone who is new to VS and UE4 C++
does not run into this issue which just plagued me for almost a week after having done UE4 C++ for many months.

I also run into this issue every time there’s a new Rocket beta, and it usually confuses me for a compile or 2 :slight_smile:

It is an extra administration step which for me has no purpose because I debug my game by running it, not by having a separate build for debugging it vs running it (standalone or editor).

This might only be some thing that applies to smaller builds like mine which are not spread among a group

But I think you pros can handle remembering to switch over to debug build a lot better than beginners and people who are new to VS like me trying to figure this out every time.

#:heart:

Hmm, could you elaborate? I’m running “Debug Editor” builds just fine, they’re the default for me.

when I run the editor, it uses the Development_Editor binary of my project

VS defaults to the Debug binary, which my editor shortcut never loads.

I dont know if other people have a different default editor shortcut that includes -debug, but here’s mine:

“C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe” -log

only thing I added was -log!

, my path looks like this

“C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe” -log -debug

Also debug_editor will only compile if the editor is closed and if you have the -debug line in the path.

I could never get the development_editor build to work.

Also i have two shortcuts, one called Debug Rocket and one called Development Rocket, both have -log but the debug has both -log and -debug

Interesting!

My rocket installs always come without the -debug line!

The plot thickens…

My rocket install come without the -debug line too, but i seen in the udn (CompilingProjects) it requires -debug in the path, so i made a few shortcuts myself.
also you informed me of -log
#Compiling Projects UDN

https://rocket.unrealengine.com/docs/ue4/INT/GettingStarted/Programming/CompilingProjects/index.html

#Consistency Please Epic

Well I think for beginners with small projects who are not used to VS, VS should use Development Editor so people dont have to add -Debug to their shortcut,

its just an extra step that beginners should not have to puzzle their way through, in my opinion.

:slight_smile:

Well I just ran over this one, - while following a tutorial i might add. It just needs a better explanation as to what the various compile modes do and when you need to restart the editor, and rebuild the editor project as opposed to the debug game editor.

It took me a while to get my head around it but I guess your not only compiling the game but your compiling the ue4 part of the IDE too.

Hello,

This is a question from the beta version of the engine. We are marking this answered for tracking purposes. If you are experiencing an issue similar to this please post a new question.

Thank you.