[4.8.1] Possible Bug with Decal

I’m not quite sure if this is a bug or if I’m doing something wrong. I have a character (mostly default TopDown Character) that I put a “Selection Decal” on. I wrote some basic code (blueprints) that when you click on a valid actor in the world, a decal appears and rotates around the actor. The code works fine, whether it’s my buildings I’m selecting or the character, the decal works and is visible.

However, once I change the default setting of “Auto Possess AI” on the character from “Disabled” to “Placed in World or Spawned” (all settings here other than disabled cause same) the decal is no longer visible. Messing with the rotation settings of the decal in the character blueprint and setting it all to 0,0,0 (if you don’t know, decals aren’t flat in the world unless you have an X90, Y-90, Z0 rotation set) I can see the decal, albeit faded and vertical.

I’ve messed with various rotation and location settings of the decal to try and get it visible while the Auto Possess AI is enabled but can’t seem to get it to work. Seeing as the decal * is * visible with Auto Possess set to Disabled leads me to believe that this is some sort of weird bug; however, given that I’m still relatively new to UE, I understand that I may be doing something wrong.

If anyone can lend a hand in helping me understand this or confirm for me that this is a bug, I would be highly appreciative. If you need any more information from me, let me know and I’ll do what I can to provide it.

Thanks

Hi jsmith,

So I’ve been able to recreate the decal to spawn under an actor in UE4, If you would post some screenshots of your scripts I can get a better idea of what your code looks like. I want to create as close as possible what you have.

If at all possible recreate this in a test blank project and upload that project to either google drive or dropbox and give me a link. This would give me a much better idea of where you’re at.

Thanks for the reply and follow through! My current project is a little verbose to post screenshots of my current implementation so I decided to try a new project. Rather than a “Blank” project, I did the TopDown Template as this is what I’m using in my project, plus not needing to import and setup a character makes it a bit easier.

Before I began copying/transferring my scripts into the new project, I was able to replicate the issue with literally very little coding. The decal in the new project is not a “selection” type decal rather just a simple decal placed under the mesh, then the character placed onto the map by hand. I created a “camera pawn” that has no controls and only a spring arm and camera for viewing the world where I set the characters.

The only code I have on the character(s) is a simple Set Relative 3D Scale for the decal on “Event Begin Play” so the decal is sized properly under the mesh. I duplicated the character blueprint so I could easily demonstrate the issue. When playing the world you’ll notice that on the top of the screen is one character blueprint that has “Auto Possess AI” enabled while the lower player has “Auto Possess AI” disabled. At that point it is easy to see that while the blueprints are exact duplicates of each other, the enabled character’s decal is not visible while the disabled is. Go into each blueprint and change the “Auto Possess AI” selector on each of them and you’ll notice the bug/issue.

Being able to replicate as bare-bones as this, proves (mostly to myself) that it’s not my code/scripts but something with the editor, even if that “something” is a mistake on my part. Perhaps another setting I’m forgetting.

Let me know if there’s any other information you need from my end. If you would like to see my entire project I can dropbox that but would rather email you the link to that. Here is the dropbox for the demo project:

I downloaded the dropbox file you linked and it’s 1KB. Literally there is nothing other than the standard empty level.

That’s strange, I zipped the folder and after I posted the link I downloaded it and retested it myself and it worked. I will try and download it again to test. If I see a problem I will try and correct it but if not, how else would you like me to get the file to you? The zipped folder is ~115 mb so I could easily email it to you if that works or I could use the “Share” feature from dropbox but again, I would need an email address to send you the share folder. Let me check the links real fast though.

Okay well I just hit the link above, it DL a 115mb zipped folder, unzipped it and ran the project file (which that I noticed was 1kb) and everything opened up and is where I saved it. The first link had a “dl=1” to force download of the file but here is a link without that. Hopefully that link works for you. If not, let me know how else you would like me to get the file to you. Thanks again for your help!

Hey,

So I have recreated something similar to what you have and what I have done is assigned a material to a cube inside of UE4. What you can do is adapt my script to what you have and create a decal that will toggle on and off. You click a player with left mouse button and it will spawn under the actor and then despawn when you right click.

I will attach some screen shots so you can see how I built it and then adapt your accordingly.

Hey,

I have created a simple script that will allow a left and right click of the mouse to change the material of a static mesh. What you can do is adapt your script to allow for spawning and unspawning of your decal. What you can do is adapt what you have to this.

Let me know if you have any further questions.

So is it a bug or is this expected and accepted behavior? Is what you’ve posted just a simple workaround?

Thx

No,

From what I was able to determine from your script you had a draw call to spawn the decal upon start. That was in the event graph. The code was determining at start of game spawn decal at this point. However you didn’t have any code that included toggling the decal from one mesh, or a coordinate space, to another.

Additionally there was no code in the Construction Script. The Construction Script is a form of creating the event you want to happen and assign it to all of the actors involved. Without both you are limited to what you had like a simple draw call.

This, of course is just a simple toggle from one static mesh to another. If, for instance, say you wanted to spawn a decal when you clicked on the floor, IE Starcraft where you click on a space in the world, what you would need to do is make the floor/world up of separate tiles and allow for the decal to be spawned in a finite space on those tiles through an array system.

In short, there are several different ways to accomplish what you want, this is the one I found most relevant and allows for modification.

This is a link to UE4’s wiki page about scripting and visual programming. This should give you enough reference to modify/code what you are wanting.

https://docs.unrealengine.com/latest/INT/Programming/

This makes sense although in my main game project, I have the code you see in the event graph being initialized from the construction script.

The explanation and solution you offer, however, does not explain why the decal works (even as I gave you in the blank project) when the character is set as human controlled but the decal fails to work when controlled by an AI. You would think that if it works in one instance it surely should work in the other.

Very true,

Basically that type of visual coding is much more complex.

I have been trying to recreate what you have done. However, I don’t think what I am recreating matches up with what you are doing.

If you would please link a copy of your whole project so I can see exactly how you are handling your blueprints I will be able to diagnose the problem with less confusion.

Thanks,

Hey,

So I had to pull on the help of the blueprint department to make this work but I have found a work around/solution to your issue. I have checked this when changing it to “placed in world or spawned.” First you will need to attach this bit of code inside of your Character Controller blueprint. NOT, and this got me, in your character Bluperint. I will attach a screenshot for how I handled it. The system is still a bit querky. I am still working to figure out how to line trace from the clicked object and trace it to the floor and spawn that decal exactly at the base of of that object.

Right now it just stretches over the surface of what you click. Any specific images like arrows or circles might not work for this but a circular highlighted area certainly would. Also in your controller make sure that there is nothing over riding what you clicked on. So say you have a function to move attacked to the same button you are using to spawn the decal. Under the InputActionSetDestination node under details there is a Consume Input option. Make sure where you have the movement input selected uncheck this option.

This honestly was a learning experience for me so if you have any questions feel free to message me back,