Yeah I know, it just does not work. Whatever I do, there is no way to include MyUIWidget.h, wether from the global Project.h or the MyUIWidget.cpp, if the .h is in the Private folder. If it is in the Public folder, the compiler requires me to uinclude the MyUIWidget.generated.h, which does not exist.
EDITED : Current solution is to put all Slate code in Private and include ProjectName/Private/SlateFileName.h from the main ProjectName.h file.
@Gwenn you aren’t going to have a MyUIWidget.generated.h. I don’t even have one of those in my tutorial, include MyUIWidget.generated.h isn’t part of any of my files. Also, what do you mean by “public folder” or “private folder”. The tutorial states the files go in /projectroot/sources/projectname/, wherever that is on your C: D: E: drive (whatever) depends on your own setup, but really you could put them wherever you want and edit the include directive appropraitely, some basic knowledge of filesystems is of course required.
I have some new code-samples up for screening. It isn’t on the front wiki page yet. It’s taken me so long to get some work out because I had a hardware failure, I’ve been racing trying to get my environment back to where it was, reinstall Windows, everything installed, download visual studio, stabilize my new hardware/bios settings, install drivers, re-write all the code I lost, re-produce some programmer art, re-download UE4 and all the sample projects, write new code etc etc, etc etc… But here they are, description is within, highly recommended you master Hello Slate first before trying to tackle it, this is quite a bit more complicated. https://wiki.unrealengine.com/Loading_Slate_Styles_%26_Resources
Hey, thank you so much for all of this. I wrote a tutorial on UDK some years ago, I know the hassle it can be. I did a clean rebuild with a correct file structure; no Classes or Private folders like in the ShooterGame demo, but with hard includes to my files in <ProjectName>.h, and this seems to work. Working on your style tutorial right now, thanks !
Hey everyone, new UE4 dev here, and having a problem trying to get this to work. I think that my problem is that the last two files are being placed in \MyProject\Intermediate\ProjectFiles\ and not in \MyProject\Source\MyProject\ . Does anyone have an idea as to what I’m doing wrong?
That will do it. If the files are in the wrong directory the include directives will break. By default Visual Studio puts new files in /MyProject/Intermediate/ProjectFiles/ when you “add new files” to your project.
I apologize for this. I talked to a UE4 dev and I was mistaken about that, any build you would want to use is fine. I just tested the sources with 4.2.1 and everything worked in a debug build. I didn’t even change a single line of code other than the #includes in cpp files to match my project’s name.
I’ve been out of practice for a couple years, wow guys you kept this alive to 4.8.
Katianie ty so much, I cant comment on validity but wiki shows lots of people have continued working on this. Glad someone found this useful, takes me back.
I should really go and clean up the comments, they are way to much “here and now” and not “top down” view of the relationships of objects.
The whole strong vs weak pointer comments should be more focused on what owns what, strong pointers imply member data and in case of weak pointers, comments should just provide a warning “be sure pointer is valid before use.”
In a “hello world” I feel people shouldn’t be encouraged to write spaghetti code, and instead taught to follow standard C++ style, construction/destruction, strong/weak pointers should reflect that, I dunno, what does Epic think about using strong pointers…
What I’m trying to say is the comments should be brought in line to represent the standard UE4 coding practice/guide.
Hi all. Three years from then, I was studying slate and found this useful tutorial that was, as everything in the wiki pages, not updated since 4.9.
I gave it a whole overhaul to 4.18 and updated everything, including comments and stuff that I thought could be confusing. I added additional comments and stuff copied from the documentation while having problems to find answers to certain compile errors I was having.
There are parts where I don’t exactly know why we are doing it this way… but it works right now.
I prefere not to include images on tutorials, since they normally are outdated all the time. I used explanations with text so that updating it is easier in the following versions.
Thanks for the tutorial ! hopfully this still helps other people in the future.