#blueprint
1 messages · Page 132 of 1
does the character actually fall ?
or if you move it up is it just floating in the air
it does fall as normal when I jump or runs off the edge of an object
and your animations are normal ?
i think part of the animation rely on isfalling, so if the animations are working then the value is working
no, because the Is Falling function kept returning true, the animation thinks the character is still falling
ok that makes sense, does gravity and everything actually work ?
when you jump you land after ?
what does the animbp look like where you use isfalling ?
when the falling boolean is true, it overrides the animation entirely with falling animation
I also print debug the function output in the character blueprint itself and it in fact only returns true
thats odd, and what are you using as a floor ? landscape ?
cube, plane and cone. All same results
they're all in a blueprint because I realized some primitive objects have weird raycast behavior by itself a while ago
so it's doing it on launch ?
your just constantly falling ?
whts strange is you can jump and it lands on the ground
the function returns false when the PlayerStart collider bottom is right above an object, but as I jump or fall once it breaks
walking on the surface without triggering a fall did not break it however
are you only dealing with isfalling in the animbp ?
or you have some code that acts on it in some way ?
ok i got the whole sequence to work, thanks to you lovely bunch, but now the lerp function is not triggering for some reason.
nothing that would interfere with the falling state
the rotator is immediatly snapping the character to the new rotation with no transition
what is scorer+ returning for a timeline ?
a float
are you trying to run a timeline and use the output value as an output ?
the time is called outside, so i had to do some gymnastics to connect it within the function
you know what, a alternative is simple enough I'll just use line trace
sure but why that did that is something to look into
you can patch it up, but fixing the problem is usually best
well so far it doesn't interfere with other things, I'll figure it out later
hmm not sure that's going to work
idk much about latent things
cant call a timeline inside a function too hmm
appreciate an elaboration for this noob lol
so move everything out of the function to an event ?
well i'm not sure how to fix it, i'm still looking at it
if you want to use a timeline, make it an event
i know in events you can use timeline
i don't think passing the value like that, and lerp is going to work very well
but again idk much about latent things, i'm still learning
found the issue, my movement state resolver wasn't set properly to handle the grounded state making it stuck in falling state
you are doing far more than learning bud
programmig been my hobby for long time, so blueprints was easy for me to grasp
visual programming is fun
i'm glad they put blueprints in ue, it's really cool thing
it really is, would be totally lost without it
speaking of AI assistants, i am trying gemini pro 1.5 now
gave it screen shots and a small description of the problem, here is troubleshooting guide.
is it a bunch of mumbo jumbo ?
Gemini pro 1.5
oh god....he totally fixed it with play from start lol
you fix one issue it spawns another haha
from origin point to first target point :
- rotation perfect
- position perftect
From 1st target to second target : - rotation perfect
- position perftect
every shot after reaching third target attempts makes the camera as if its trying to go back somewhere and then returns lol
when modifying the structure, I would like it not to clear the variable values. How can I do this?
DataTable?
if the structure is large and I change the type of the variable, it resets all the values that have been set in the widget
or even in case of DataTable it is unavoidable?
I love those nodes (like String Append) that have an "add pin" feature, kind of the equivalent of JavaScript rest operator. Is there a way to implement this in a pure blueprint custom function or macro?
probably with c++, i don't think you can in bp
Custom nodes yeah^^
Did you try setting it up like how I sketched out?
whats more performant, a textrender or a widget ?
Bet its pretty negligable
Got a random question, so in my Animation BP, I know I can make random idle animations by putting in a Random Sequence Player, but how can I get different idle animations in a Blend Space?
what about actually spawning them ? is the create widget at all expensive ? lets say it's not may things, maybe just some text and an image, possibly an animation
even if i don't notice much of a difference i like to know what is more performant or if something is going to be a problem at a later point
maybe #animation might know the best way to go about that
I assume you are talking about the widget component?
well i was thinking a 3d widget
i have not used it yet
just wondering if a bunch of 3d widgets on the screen is a problem
ig i'll know if i run into it, but i like to know like i said whats more performant
so your saying it's not a difference, ok
depends
so the thing about widget components is they are rendering a widget to a render target
and then display that RT as a texture
interesting
for damage numbers I'd probably create and animate them in a widget
thats what i'm thinking as well, because textrender doesn't have animations i'd have to create some wild stuff
makes sense
I use this to snap the position of my crosshair to be over a location in worldspace
hmm, so just create it in the main hud widget dynamically, animate it, then delete ?
i c with this i can do what i want to do with the numbers
yea spawn a damage number widget, give it a target actor and have it snap to its location on tick maybe
and the animation would be either inside the number widget, or you can add an offset when you set the position (probably better)
maybe even use a curve
well i'm using it for points, so i would just put it above my character and make it float up
thats what i did with the textrender
i'll just try a widget and see if it tanks, i was just wondering because i don't really "need" animations
but people like to see fancy things
Im being lazy
yea you could try also using just a single widget component
one per number might cause a problem, maybe
Do anim-> transform up -> delete
but one widget component you spawn the numbers in will definitely not be an issue
well i want multiple numbers
I do multiple numbers
but i stop it when it gets to a certain point
i literally use the position to then add to the score
so it floats up into the score
instead of a timer so it works perfect every time
i don't know if an animation could do that ?
oh you want it to move to the score
right, like this
https://streamable.com/jzfso6
yea I'd definitely do it in a regular widget then
frankly you'll probably want to have 2/3rds of the visible space be in front of the character
the space behind isn't as important
pretty much every side scroller does that and only centers out when you stand still
wdym
you'd have a scene component in the character to which the camera is attached instead, and you'd take the player velocity, map it to whatever range you want and then set that to the relative position of that scene component along axis the player moves
Shift the camera center to be a bit to the right of char
Looking left usually doesnt matter
Were it does matter, they tend to shift the offset depending on your direction
I was sure Ori did this 😂
so that the camera sort of follows it ?
But camera just lags behind the char, who usually is in the center
right i know what your saying i had a way i was thinking about to do that
but using the velocity if i can makes sense
i was just going to move the camera left or right based on location of the player and some delay or something
hollow knight and ori have you navigate vertical spaces while fighting enemies
centered camera is better there
platformers not focused on combat tend to prefer to lock you onto a specific z axis and only shift up when you start moving out of the screen
and because you won't be flanked by enemies from behind they prioritize the space in front of you
i c
i'll play with the velocity range thing see if i can make it look better, that messes with the points going up into the score that will be a bit more difficult
Here you see offset changed based on the velocity of the player
damn that is a really well done camera system they got there
the pan down that accelerates faster than the lift is a nice touch
though thinking about it that is probably just driven by the same logic that handles the camera offset while running
just a nice side effect
Question; In Unity you can call this in C# to get a reference to a world position Target.position where Target is a Transform component. The versatility comes from the fact that every single GameObject in the scene must have a Transform component, so you can easily get the position of any Target that is passed in.
What is the Blueprint equivalent of this?
every actor in unreal has a root component and its transform defines the transform of the actor itself
unless I misunderstood you
you can store transforms
Yes, but can I reference another actors transform by storing it as a public variable?
any object placed in the level is an actor and you can access their transform
Okay. Then I think Actor is the type.
I have a camera that needs to orbit a target, but the target could be anything, really.
So the "anything" in Unity would be Transform.
The "Anything" in Unreal sounds like it's an Actor.
yea just have an actor reference and get the location from there
Alright, thanks.
A bit of a problem that I can't set a class default value for an Actor reference.
what exactly do you intend to do?
I'm currently trying to transfer some Unity code to Blueprint
you can make it a class instead of an object reference but I don't think that's it
Seems it just extrapolates based on velocity
And in Unity I'd ask for a transform reference in code, then in editor I'd set the transform I want as the target by drag-and-drop.
In Unreal, the character blueprint is just another blueprint™️ so there are no editor instances of it until runtime. At that point it's too late to set a reference.
The idea is to let designers have freedom to choose but that the default reference could exist in it's own hierarchy
and both actors are in the same level
there is an eyedropper tool in the details panel
It's greyed out
so you can select the target actor there and get its location
you need to set this on an instance
But you know, it hit me that I should separate out the actor I'm working on so it's separate from the player.
you can't add a reference to an instance in a class
really though
are the camera and the target both actors?
if the camera is or is managed by a component in the actor it can just get its owner
if they are actors they'd probably still communicate
or some kind of manager is aware of them both and can give a reference
the approach depends on the specifics
I think I'll do what I did in Unity and see how that works. Basically the camera is just it's own and you can drop one in scene, customize it and then point it to a target in scene as well.
In Unreal I'll probably just tell it to find the Character controller in the scene until I find a different setup.
yep, what I suggested sounds like what you want
public actor reference for the target
and then when you place the camera in the level you can eyedrop it to any other object in the level
alternatively consider making a component that spawns your camera and attaches it to its owner
then you add that component to any actor you want
+1 for team component
Help me, please. I have a FPS Player and a Drone (type Character). I possess FPS Player and use Input to control that Drone (look like remote control drone). But the function Add Movement Input on Drone doesn't working. If I change possess to Drone, the function works normally. All Input have written in Player Controller for general using when changing possessed player.
The issue only happens with Drone spawned from Blueprint. With Drone is placed to the world at the editor, the function works normally (meaning I can control Drone when possessing FPS Player).
why don't you possess the drone and how are you moving it?
You can change the tickgroup of a bp
But if I want Tick and Late Tick in the same BP, that's a no?
Thats a no out of the box atleast
Guess you can abuse a second actor to get the second tick
Alright
problem is the scene component rotates with the capsule
not necessarily
i can set the position manually ig
bingo thanks
You know, I know that I wrote this line. But I'm not sure why I wrote it like this.
if (StayBehindTarget == false ? SetRotation() : SetRotation() || OrbitBehind())
If the first condition comes out as true, then return a bool from SetRotation()
If the first condition comes out as false, then either SetRotation() OR OrbitBehind() must return true
How to make my child gamemode execute on his "onLogin" the parent's onLogin code first then execute what I'm adding to it in the child onLogin event ?
Since Epsilon is not an accessible value in Blueprint, what does one use instead?
This also is one of the cores of OOP
?
Yeah but I don't know how to do that in blueprint
Thank you 🙏
Crashed Unreal Editor with this error...
Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp] [Line: 1459] Failed to find function DelayedSave in BP_LevelGameMode_C
And it's correct! That function was removed.
But like, from this information how do I find WHERE that reference to the deleted function IS?
Hopefully you're not a vivid user of Set Timer by function name
hello
i have an base spell with a tsubclassof<baseanimation> called animclass. i set the animclass to projectileanimation, which derives baseanimation and contains some variables with the expose on spawn meta tag. but when a try to call spawnactor on projectileanimation in the unreal editor, it doesnt show the exposed variables of projectileanimation, only baseanimation. i see why this happens, but i dont know what the best solution would be to be able to set different variables on spawn depending on what class i use.
someone?
Is it possible to do a BoxCast in Blueprint?
It seems I can only find raycast
Or "line trace"
there is sphere trace i think
Isnt there boxtrace aswell
I don't think this is possible in blueprints. If you want to have "dynamic" exposed variables, then I think an alternative would be to have some exposed TMaps of say GameplayTag > Int / GameplayTag > Float / etc. in your base class, then have an overridable function that you call on begin play that populates the values from these maps into the appropriate variables.
How can I make the player's head look at a location smoothly without jumping to it
The code above looks at the right location needed but it snaps
thanks im gonna try this
is it triggerable? or it continously runs?
you got few options.
lerp or timeline for triggers.
Or adding rotation * rotation speed every tick
#multiplayer is prly best place to ask
What's the easiest way to find out WHERE this call actually is?
Keyword search I guess. Awkward that there's no link
Hey advice!
im doing a gun fire function and i wanna add some simple spread, how would i best do it ? just add some offset to the forward vector or ?
Tick -> interpolate
smoothly means per frame means something somewhere is doing the work on tick or the equivelent
you could do it in your anim bp
The typical pattern is:
WhateverEvent -> set target
Tick -> interpolate actual towards target
Depends. Realistic spread is typically a cone distribution so I'd start with the random unit vector in cone
@steady night I'm new myself, but IIRC keep Start as it is now, but in the add pin right before you End (where you're adding the Forward to the Location) you will also want to add some random "jitter" to the location. That is, you'll add some random (- or +) values within a range to the vector before sending it to End. The amount you want to jitter depends on what kind of game you're doing, what kind of weapon you're firing (shotgun vs sniper rilfe in a scope vs sniper rifle hip fired, etc), etc.
I'm trying to think if there's a way to do it with no rotations involved
yeah thats what i had in mind it just depends on the total range of the "bullet"
how much offsett would be needed and so forth
There's someone else's BP doing the same thing
Should get you started
I would probably start with this, then transform it based on the transform of the actual aiming thing
Random Unit Vector in Cone in Degrees
Oh that's even better
that'll work but it'll break down in certain orientations
is this a 2d or 3d shooter, are you ever shooting up or down or mostly in the horizontal plane?
3rd
yeah I would use
TransformDirection(RandomVectorInCone, PistolFireLoc.GetWorldTransform) as the vector direction
feed spread into the random vector node
just feed the spread in
what would the value range be ?
if you feed it a 5 it'll be a cone with a 10 degree angle
feed it a 45 and it'll be a 90 degree cone
oh
What's the easiest way to create a struct in blueprints where I can store room data? I.e., I want to store:
Vector3 Position
Vector3 Size
In one variable called Room or something
like multiple variable types in one
i am absolutely stumped
i have to characters and one is ai and the other controlled but the animation components seem to be linked in terms of input from the controller
i'm trying to get the interp speed correct i'm using vinterp
i figure if i can calculate the interp speed right it won't slide so fast when i change directions
i thinks because it's set to 1.0
it going the bigger distance in 1.0
if you want interpolation just use a springarm with lag imo
ah I can see how changing direction would be an issue
your character probably has high friction
how did you make the second character ?
since it's not moving, seems like just the animations
ok i'll look into that, i was just trying what you said and it's difficult
almost had it but i was just trying random stuff to get the interp speed
Velocity isnt normalized
this suggests that you think it is
velocity is direction * magnitude
so you'd want to normalize that beofre multiplying with CameraMover
Right click in the context browser and create a structure from the blueprint section
yea i got there lol thank you
no we do want the vector length, but I'd suggest mapping that to a float range
fair enough
i just scrapped it it wasn't that great of a feature for this particular game
i will try with lag
see if that is any better but it didn't seem to good to play
once things are smoothed out might be better
I am currently trying to set an Enum that i am using to control a 2d character's animations, but for some reason my code isn't setting the Enum to Right or Up. When printing the values of Velocity X and Y, everything is as expected, its just the Enum that isn't being set correctly. I think my math is somehow off.
Another weird aspect is Up and Right can be set sometimes, but only if both Vx and Vy are non-zero values, its so weird
note: Due to the orientation of the CharacterMovement component, Down is a Positive Vx value, and Left is a Positive Vy value, dont ask why lmao
are you controlling a sprite with this 😄
yes, in the style of Octopath, that 2.5d style
// Do we have any velocity?
if (Velocity.Length > 0.f)
{
// Is our X bigger than our Y
if (Abs(Velocity.X) > Abs(Velcotiy.Y)
{
// Is X Positive
if (Velocity.X > 0)
{
Direction = Up;
}
// or Negative
else
{
Direction = Down :
}
}
// Our Y was bigger :)
else
{
// Is Y Positive
if (Velocity.Y > 0)
{
Direction = Right;
}
// or Negative?
else
{
Direction = Left;
}
}
}
and it's smooth when you swap any direction at any time ?
yes
i'll give it a try, idk if this will even work for this game but it's worth a shot i like to try stuff just to see and also to learn
interp speed is pretty low
i got default movespeed to 600,
so 0.5 for multipler and 1 for interp speed was alright for me
If it's to fast I think it'll be painfull for the player : P
could make it adjustable in a settings menu tho
whoops turns out i accidentally only set the value if vx or vy were positive in the previous branch, lol, lmao even
it worked really well actually
worked like a charm
i didn't know there was a socket offset
spring arm is underrated ^^
pretty smooth yeah
i'd say it might be a tad fast still
causes a lot of movement whenever you switch direction or just start moving ^^
there's also easeinout if you wanna try that
not sure how well it works with dynamic start tho
probably not so well
slap a bool on it so you can deactivate the feature 😄
probably
@faint pasture ?
it's not bad actually when it's subtle adds a bit of movement to things and it's definately playable like this
https://streamable.com/7l3nj8
just i use velocity all over the place
so it's a little f'd at times but not too bad
hello, any reasons why the hide bone by name node doesnt work for children of a skeletal mesh?
not at all
use transform direction vector
Transform Direction
@faint pastureoh ok but what transform :/?
the transform of the muzzle or whatever you've been getting the forward vector of
you could also use rotate vector which would do the same thing
Hi folks, just started with unreal so I apologize if this is really obvious. im trying to build a "choreographed" bullet hell attack, but nothing fancy for now.
Basically I created an actor with a ton of different arrow components to indicate where projectiles would spawn//what direction to travel.
I then set a map for integer:Transform, to where I got the world transform for each arrow, and input an integer to represent each arrow.
I then created a timeline that "Finds" from the map, pulling the integers from the timeline. However, I notice that sometimes it'll fire in a random direction, or some directions get completely skipped
random vector in cone will give you a vector in a cone centered on 1,0,0
rotating or transforming that vector with the rotation or transformation of your muzzle will rotate the whole thing to align with the muzzle with the random offset
Hey guys, I'm trying to set a variable's value from a blueprint inside another one. I cast to the blueprint that holds the variable but I'm not sure what to put in the "object" pin. Isn't the "cast to BP... " already referencing my other blueprint?
framerate and aliasing
Use a timer instead
timer, index math, an array of scene components as your firing locations/directions
Timer fires -> increment counter -> choose scene component -> fire bullet from it
just to clarify: you're saying the issue im having is due to framerate and aliasing, and are proposing using a timer instead?
yes
you're either skipping over or double firing some bullets as the float is just barely going above your truncated cutoff
the timer method will never fail, if framerate drops too low it'll of course have to fire multiple on a frame but it'll still not skip any
i think i see. honestly not sure i fully understand, but im all for any improvements that will make it more consistent
i just started this last week, what timer node do you recommend?
Thanks so much
so i im trying to make a container that a player will find loot in but ive followed the belove video (re checked it twice) and when i go to interact with the container nothing happens and my interact key works because i have a item on the floor im able to pick up and see in my own inventory any sugestions? also this is my first ever project so im really new to unreal and code stuff in general https://www.youtube.com/watch?v=l6eXqK0zHHI&list=PL4G2bSPE_8umjCYXbq0v5IoV-Wi_WAxC3&index=11
We are revisiting one of my first series on the channel; the inventory system series, this time with different implementations, improvements, and now in Unreal Engine 5.
In Part 11 we develop the inventory for our container.
SUPPORT ME
Patreon I https://www.patreon.com/ryanlaley
Buy Me a Coffee I buymeacoffee.com/RyanLaley
Donations I paypal....
Ahhh small question
i created a menu widget and would like to open the level when begin button is clicked
it does load the level, but the menu does not get removed
the main menu is loaded in the main level blueprint and this is the main menu blueprint
this is where it is added in the viewport
is this #multiplayer ?
yes it will be a multiplayer game
is this beginplay of the character ?
i dont think so it is in the main level blueprint
i created a loop not knowing, it reloads itself
damn that took time to figure out haha and oh that is gonna take some gymanstic to fix
I have a laser system in a BP and I want to modify the intensity value set in its BP in a different BP. I created a laser variable (actor ref) and used cast to the BP. unfortunately it's not working. Does something look wrong?
what did you set laser to ? or how did you set the actual reference ?
The value i'm reading with print string is correct
Actor ref then clicked on the object in my scene
so the cast is not failing ?
it doesnt look like it as my print string works until the end of the chain
It's referencing to the laser BP
so your print string works after the cast ?
yeah
the value is correct come out of the clamp ?
yes
are you setting that variable elsewhere ?
Why are you casting here
casting is not a "send a message"
yes in the laser BP
Your code here is asking "Is Laser a BP_Laser_perspective_mode? If it is, set its visibility to this float"
and you probably don't need cast if you selecte the exact object ?
it should be that class
Show where you tell Laser what it should refer to
show where you set Laser
Probably nowhere
how the hell can i chnage this to a normal range
Im using the "laser with shadows" assest and the set intensity variable is editable in the outliner. The BP is big so I cant screenshot it
You have something that wants to talk to A laser in the world, correct?
How does it know WHICH one to talk to?
I though casting to the BP and referencing it woudl work. Once I cast to the BP I can set the value of the variable from that BP
I'm guessing what you have is a variable called Laser which is of the type BP_Laser_whatever reference.
You need to set that. You're saying that Laser REFERS to a BP_Laser_whatever, but you never tell it which one.
casting is not what you think it is
is there anywhere in your code where you SET Laser?
You have a bucket that can fit a laser in it but theres no laser in it since you haven't put one in. It's just a laser shaped bucket.
does anyone know whay this would be failing?
PlayerController 0 is not a MyController
assuming it's failing the cast which you mean by "failing"
Probably GetActorOfClass on begin play
Ok, so which node should I use in my "main" BP to tell it to go look for BP_laser, find the intensity variable and SET it?
if the laser is around and there's only one of them it'll fetch that reference
but it's up to you How does your main BP know which laser it cares about?
mb
also check what's being exported with a fbx or gltf viewer
Theres only one
gotcha
Explain the setup, what is this laser and what is holding it etc?
im new im not sure what that means tbh and i only said failiing cause it prints the string i set to " cast failed"
is it a laser being held by a character? or on a character's gun?
It means exactly what it sounds like
have you told the gamemode to use MyController as the default playercontroller?
well ive been following a guide for a inventory system and he created a controller called "my controller" ive tried to merge the two before and had issue
it's just a laser like a concert laser.
ok so just a laser in the world. Using GetActorOfClass will work fine for now
Do you have a custom gamemode class?
if you do, show its properties for default pawn and playercontroller etc
if you don't, then your playercontroller isn't being used, you need to make one
this doesnt work, should i go straight to getactorofclass without cast to ?
The cast is failing because Laser isn't anything
if you remove the cast it'll work
but you won't be using the Laser variable at all
i dont care about the laser variable, i just created it to ref
you'll want to instead have:
BeginPlay -> Laser = GetActorOfClass(BPLaserWhatever)
Tick or Whatever Event -> Laser.Visibility = Clamp(whatever)
What you have is like looking someone up in a phone book every time you want to call them, when you could just save their number
i dont think i do? my player controll class is still default but when i try to cast to the other controls one of my vairables says its not combatible with it
when i remove the getactorofclass from my chain and put it separtely at the eventbegingplay then my SET intensity lacks a target :/
The "HUD" variable target is expecting a "MyController" reference. Your "BP_FirstPersonCharacter" isn't and does not inherit from "MyController".
ok so how would i fix this? sorry its my first project so i dont really know anything
probably along the way you didn't set you controller in the game mode override
Well you can't plug in the BP_FirstPersonCharacter into that target as it's not what it is expecting. In order to specify what your default PlayerController class is, you need to create a custom game mode. When the custom game mode is created and you specify it as the game mode to use for your level, then you can select the default player controller class to MyController. Once that is done, that cast should probably succeed.
ok so how do i check the default class is it in the "BP_FirstPersonGameMode" because when i change the controlls there i lose movement from both my mouse and keys
The print string shows everything is working but it's actually not doing anything. The value is correct, but has no impact on the variable that I'm trying to modify. Event begin play goes into my osc handler
It’s late for me so I’m off to bed but thanks for the help anyways @faint pasture @dawn gazelle
Are you sure changing that variable does anything?
and when is that variable being changed, all the time?
Hey guys, I'm having trouble with some basic geometry lol. I'm trying to check if two boxes overlap. I have the four corners of each box as vectors. I thought I could do:
RoomA.MinX < RoomB.MaxX and RoomA.MaxX > RoomB.MinX
and
RoomA.MinY < RoomB.MaxY and RoomA.MaxY > RoomB.MinY
But I'm pretty sure my blueprint nodes need some correcting or im misunderstanding something
im trying to build a dungeon generator from scratch
overlap at all or overlap completely?
and are they axis aligned or at any old orientation?
completely so there's no overlap on any corner
they all basically start at the DungeonGenerator origin, then pushed on the X,Y axis as their position
then scaled via X, Y
for size
this is how i calculate the corners
That seems like a bit much, just need to make a function to check if a point is inside a box, then check that all 8 points are inside the box in a loop
might be correct but it's pretty unraveled
to "check if a point is inside a box" is what im doing tho
in the main menu there is a button load the level but its loading the menu with the level lol
got a quick question about the construction script.
if i spawn in an actor, is it possible to have it set a value on spawn ? like a constructor would in code ?
For example i want a damage number to fly out of my enemy, on creation of the actor i want my Enemy script to send whatever damage is being delt to the enemy to the actor on creation.
Oh you mean for checking each of the 8 xs and ys
❓
bruh
lmao
watch there be a "IsBoxInBox"
❤️ pat pat
there is no shame in learning bro
we all learning here
you got +12 BPXP
it happens my man dont let it get to you
there are a billion usefull nodes in unreal ...
Yeah when I use the slider in the outliner
what do you mean by each load? like each time "begin play" is called? I don't think that's possible since you need to add the menu to the viewport through some execution...
Only when I move a slider in Resolume. It sends an OSC message that is received correctly by unreal
i create the mainmenu widget in the HUD, and on it there is a button to load the level, when the level loads, i am back on the menu, it does not actaully go to the game
yea, frankly just make an entire gamemode just for the menu
you can try setting the visibility of the main menu to none
this is the right way
why'd you use the same hud class for the main menu and game
unless you do them both in the same level, but then you'd not be having this issue
i feel like having no main menu level is just bad design imo
interesting, how come?
Is this the part where I tell you about how we have 1 level and that's it?
never change level
no hard cuts from startup to shutdown
except for the unavoidable hard load when joining a multiplayer game
isn't it a lot of extra work though
just cause 3 does it too
any downside to that ?
initial loading time for one
it's proc gen so not much to load
well, unless you stream the world in later
or generate yea
though might as well do any loading you can async during the main menu
So what you are saying i should do this in the main level blue print or what ?
not that you should, it has advantages and disadvantages
okay so what do you think of this
it's certainly much nicer to work with a separate level
we need an ai assistant in unreal engine pronto lol
GitHub Copilot for C++ works pretty well
in visual studio
OMG I FIGURED IT OUT
i had in certain blueprint get playter pawn when it should have been get owning actor
This worked!
Hey, aren't Structures technically a form of communication between blueprint classes?
they're just composite data, a group of variables
I don't get the issue, why is this not possible??
both of my variables are of the exact same pin type???
is Stages an array of FQuestDetails?
yes it is
In a blueprint, if you change the value of a variable for an implemented structure, does that change the value for the variable in the blueprint structure asset and across all blueprints that implement the structure?
LogBlueprint: Warning: Recursion: Recursion: Struct cannot have itself or a nested struct member referencing itself as a member variable. Struct 'UserDefinedStruct /Game/Quest_System/FQuestDetails.FQuestDetails', recursive parent 'UserDefinedStruct /Game/Quest_System/FQuestDetails.FQuestDetails'
if you set a default value and those blueprints are on the default then yes
So in a way, a blueprint can indirectly communicate with another blueprint class through a structure and its variables?
no
Where am I wrong?
Does anyone know why a print string wouldn't print????
none of them are printing. but all of the other nodes after work
Well for example, If i had a character blueprint that held it's health in a structure, and I wanted a separate blueprint class to access the characters health... I could implement the structure in the separate blueprint class and access the variable that way correct?
I have this variable that is marked as public and all the settings for it are shown in the picture. The object that this variable is in needs to inherit from the Pawn class so it can have AI capabilities and this variable needs to be exposed in the main editor window when the object is dragged into the scene. The problem is that when the object inherits from the Pawn class, the variable isn't visible in the main window, but when I change it so that the object inherits from the Actor class, it is visible there. I've tried looking this problem up, but I can't find anything mentioning why this happens, let alone how to fix it. Thanks!
no
why not?
ohhh thank you i got it, took me a while to realize
jesus
I don’t understand. You’re showing us a vector array and saying you want it to “inherit from pawn”.
because you're changing a variable in the character, not in the separate blueprint
Sorry, the class that contains this variable inherits from pawn.
Oh, mb misread
no worries
So you can’t expose it if it’s in Pawn ?
But your expose on spawn is not checked in the screenshot
so If I change the variable in the character, it won't change in the structure?
Expose on spawn is just for when you are using the "Spawn Actor from Class" node, right? With the same settings shown in the screenshot, the variable appears when when the class inherits from Actor, but not when it Inherits from Pawn.
the structure you define in code (or blueprint binary) sits on your hard drive
so why can't I access that in a seperate blueprint?
it's literally part of your games code
Where do you need it to appear exactly, maybe I’m misunderstanding
so I can or cannot?
And did you make sure to recompile
well yea, you could change the data and then recompile your game
but that is completely unrelated to communication
this is just confusing me more 💀
This is what it looks like when it inherits from Actor and is what I want, but when I change it to pawn, it just dissappears.
Now its suddenly gone when I change it to Pawn
the structure you define and its default values are literally part of the program itself, they're not part of the game instance that runs in memory
I see, so you can't change that default value during runtime?
nope
dumb question- i'm using the third person template, how do I make the camera not move downward when I use the built in Crouch node?
let me explain it this way
Ohh that makes sense. See I thought from this that you could
the struct in your content browser is like your player character bp
when you add the struct to your character it's kinda like dragging that character onto the level or adding it to your game mode
now when the game actually starts these are all just templates to create instances of
I see
i.e. a version of the character and the struct that exist in the memory (RAM)
these are what actually can be used at runtime
This make's sense now
every single instance is entiely its own object
so if you add the same struct to two BPs that just means you have two instances that inherit from it
Before I thought that you could directly change the value's of the variables inside of a structure during runtime. So I thought you could communicate indirectly between blueprints by accesing the variables held in a structure and setting and getting them
So like an alternative to directly communicating to a blueprint to get it's variable
but I see now, why that is not possible
the closest thing to that is how saving and loading works
saving and loading?
writing to and reading from an actual file on the regular system storage that will not disappear when the program is closed
Why my characters are floating from the point of view of the other player ?
Alright I think this helped
I Appreciate your explanation and help 🙏
thanks
if you want regular variables you can access anywhere that's what subsystems are for but require C++ to setup
isn't that just a global variable?
well, it's an object you can store data and define logic in with a clearly defined scope
A game instance subsystem is pretty much completely global as the game instance is practically the game itself
the enhanced input for example is a local player subsystem
anybody got any thoughts on this? i figured it would be a setting in the character controller but I'm not seeing anything..
i'm guessing this is for first person games, you'd want the camera to 'duck' with the player, but I'm making a third person game and it's just jarring. starting to wonder if I'll just need to roll my own crouch functionality
the half height of the capsule collision gets smaller when the player crouches
consequently the capsule moves down so it touches the ground
the camera inherits its location so it follows
probably just attach it to the mesh instead
This was meant for a diff person lol #blueprint message
You recompiled and saved the bp and placed it again, I imagine?
I want to have player's perspective. It looks like you are controlling the drone by remote control in the game. The drone is moved by EnhancedInput in PlayerController, the Player too. WASD to move Player and Up, Right, Down, Left to move Drone.
I was not replying to you haha, just unfortunate timing
and us both happening to mention recompiling
Odd, I’ll test in a sec
ive created a lock on system that interpolates the camera to always face an enemy actor however ive taken a liking to the dmc camera system where it more or less just makes sure that both objects are in frame
is there something that I can do to check on both actors and sort of equalize where the camera is viewing based on that
yeah but its not necessarily taking a mid point between the two
I tested by making a test pawn with a test vector array and making that array instance editable. placed it in level and it shows
reparented to actor and back and still there
maybe you have some sort of bp corruption, you could try remaking the bp @north rain
@lunar sleet I'll give it a try, thank you for testing it out.
I wouldn't be surprised if it got messed up since I originally made it as an Actor, and then reparented to Pawn and that mightve messed some stuff up
I changed the ThirdPersonController so that the left and right keys would rotate the character in place. Just like tank controls. This was the only part I changed. How can I increase the rotation speed?
Interpolate to target rotation instead
Keyboard a increment the target by x factor
Keyboard d decrement the target by x factor
X is your speed
Interpolate from current rotation to target rotation
What you have right now is framerate dependent btw
you want value x speed x deltaseconds
and you're better off using add controller rotation instead of get and set unless you have some specific reason to do that
add controller yaw and add controller pitch
yah, that worked. Weird thing is that when I was making this new BP, I put the variable and I put it in a category called "Navigation" and it isn't visible, but then when I change it to a different category it does appear. When I try changing the category on the original BP, it still doesn't appear.
Yeah odd
I guess maybe that Category name is just reserved even though it doesn't appear in the list?
So like this? I'm not sure how to put the rotator return value into the Add Roll Input
no
just multiply value, speed, and delta seconds, and feed it into Val
it's asking how much roll you wanna add
What are the Add Controller Pitch/Yaw/Roll Nodes in Unreal Engine 4
Source Files: https://github.com/MWadstein/UnrealEngineProjects/tree/WTF-Examples
Note: You will need to be logged into your Epic approved GitHub account to access these examples files. https://github.com/EpicGames/Signup
assuming you're in a pawn, you can add the values to YOUR controller's rotation, not just the first player controllers rotation
How can I go out of an array (GetAllActorsFromClass) into a scene component object reference target? Basically telling the BP to select all actors of class and doing the same action for every single one of them?
the for each loop applies to all objects in the BP and I cant figure out how to select only one SM in the blueprint
The foreachloop runs throigh all the actors.
Then you can "getCompomemtOfClass"
Or GetCompomemtWithTag
Which scene component?
An actor might have 100
Use an interface. If the object implements the interface it’ll fire off the event / do the action if it does not use it then nothing will happen or break. You could also do this with an event dispatcher, have all blueprints that need to perform the action bind to the event on their being play
What is the actual mechanic you are trying to implement?
But getting all actors of class is expensive, could cast to a manager (game mode, instance ext and set an array on there, when the being play fires you get a reference to it and add itself to the array, when you need to trigger the action you loop through said array as all the needed assets should be inside it
I have a NS that I want to fire on custom event. Couldnt figure out how to activate/deactivate with a flip flop so I used the toggle visibility.
https://youtu.be/EM_HYqQdToE?si=yWgu4bRCNLoftJPE for reference, there is sections in here about interfaces and event dispatchers that might cover what your looking for
Announce Post: https://forums.unrealengine.com/showthread.php?101051
This Training Stream takes a look at Blueprint Communication. We find that Unreal Developers of all levels can sometimes struggle through the concepts behind moving data between objects. So in this video we'll take a look at the different ways to make Blueprints talk to one an...
This works. Not ideal but it works
Thank you for the link, I m going to watch it. Im pretty new to BPs so I have a lot to learn
Out of curiosity. What is preventing Epic from exposing more features into blueprint? Why isn't every built in function marked as BlueprintCallable(not counting functions that use non blueprint supported things, like e.g. pointers to structs)
What's the ACTUAL thing?
When XXX in the game happens, you want XXXXX to happen.
I have a BP that receives OSC messages. I have a BP with a SM and a NS as a child of the SM. I added 2 of the NS BP in my scene. I want my particle systems to be de-activated at runtime. Then, when I send the value 0 through OSC, I want the particle systems of both NS BPs to activate then de-activate again when OSC stops sending the value 0.
I think you responded to the wrong person xD
My bad, that was for @faint pasture 🙂
So I simplified it to this. If I divide TurnSpeed then it works. If I multiply TurnSpeed then it doesn't work. Regardless if I multiple or divide TurnSpeed, if I then multiply by deltaseconds then it doesn't work. How would I make this not framerate dependent?
Much of it could with ease be made BlueprintCallable. Even in cpp, alot of times there's missing virtual on functions that would clearly be handynto overridenin a child class 😅
Nothing is really stopping them
Time constraints and whatnot i guess
sorry if im just barging in here!
got an issue to do with line trace, though -- been driving me a little bit insane. not an unreal expert so i figure maybe theres just some small piece of info im missing.
i have an actor with a static mesh that i want to be hit by a line trace. it is Not doing that.
- first image is my current line trace blueprint (disconnected everything that comes after, all im looking to see right now is if it'll turn green when it hits my mesh. previous node is just event tick)
- second is my mesh component's collision settings
- third is the line trace going through my actor
- fourth is a random unreal cube with default settings going through the line trace, proof that it at least works and is more to do with my actor.
ive tried just throwing the mesh itself into the scene on its own, but that doesnt do anything either. it's custom (not particularly amazing, meant to sort of be a placeholder atm) so if that can cause any issues, i suppose that might be what's happening. it's also a child actor of the blueprint that creates the line trace, but when i press play another child that only exists for a few seconds is clearly detected as well, so im not sure that's the issue.
if anyone can help i will cry tears of joy 🙏
Ask the cool kids, you know where they are 🤣
Why does this raycast always goes forward instead of the direction of the camera where I'm looking at ? 🤔
Why do u need the rotation at all?
If u want it to point where the camera look at just get its forward vector
that's what I had before and didn't work, then I tried with "Rotation" but doesn't work either
If it's always the player camera u can use the camera managee
Get player camera
I don't know what object current camera is
It contains the current active camera as I have a system where you can switch between FPS and TPS
But depend on how u access it, u may or may not get the data correctly
Sry not gonna check it
I think camera should be handled locally anyway
F me dead if I have to wait a second to toggle my camera
the reason I did that on the server is because I need the camera to do the raycast, and I can't trust the client to give me the info of where the raycast should start
U shouldn't worry about cheating when using blueprint only. Focus on with the limited power on what you can do
mesh had no collider 🥲
U don't even have server validation in blueprint
huh ?
what do you mean by "server validation" ?
i highly doubt that
@bleak crystal u have more chance getting answer with 1 question at a time. Write it as descriptive as possible but keep it short.
Provide relevant material to that question alone
was only one question, just wanted to get all the info out there. etiquette varies from place to place, i suppose. been told before im not descriptive enough lol
you need to write code that pats the server on the back and says good job
only doable in cpp tho
Could you explain a bit more please because I'm kinda confused
There's a process one can do with rpc in cpp to drop rpc when it's not valid
that was a joke sry. #multiplayer prly has pins and folk that can answer this stuff, but afaik basically it makes sure that all the data that comes through is correct
Takes a few min to search it
Start reading then
reading what and where ?
try adding a collision box to your actor and see if that does it
and also maybe restart engine just for sanity's sake @bleak crystal
alright, but coming back to my first question about the raycast, do you have any idea of why it happens ? @lunar sleet you too please ? 🙂
The scope shifted when it is a multiplayer game
@bleak crystal did you say this object is a child of the actor that fires the line trace code? I'm confused
why are you plugging in the rotation into the forward vector?
your start should be camera location, your end should be cam fwd vector * desired distance + cam location
world location or relative location ?
that's what I already have
k, so what's happening exactly?
The raycast always point forward of the capsule / Character Mesh instead of the camera forward. Like for instance when I look up, I expect the raycast to go up but it keeps going forward (parallel to the floor)
how often are you firing the trace
Damn colliders hiding away
oops, didn't notice you fixed your issue, sry for the spam todo 😅
each time I press Left Click
sec testing
example
works fine on my end, even works with Camera as channel
I put this in the FPS template
Hey! my project is so far coming along, my current attempt that im having an issue with is i want to create a function in my button to change the players POV to a camera pov. like a cutscene or like a telescope/binoculars zoom in games where you see through it and can hit ESC to go back to normal. Any ideas?
yes
so why are you validating the camera component?
if it exists in that bp
🤷♂️
prly just change the FOV and add some kind of decal in front of it, or a postprocessing to make it look like a black circle around it? 🤷
lol
your camera component exists in your bp, there's no reason to check if it's valid, you know it's valid, it's there
i did that as a precaution in case "Current Camera" is set to None
oh, is that switching between 2 cameras ?
Yes
ok, well did you check if it passes the valid check?
and if the current camera is updated ..
It does
let me check that
Doesn't matter if it get the wrong cam at the time of accessing it
Imagine doing something like server rpc change cam value , then set the cam right away
Not gonna work especially with a slight ping
No clue what this setup is about x)
havn't really paid attention, trying to actually get work done
If u wonder why because it takes x amount of time for variable to be updated from server to client
X being round trip time
Something you should look at if doing mp
The Client and the Server both have the same value in both cases
wait a minute
the one above was when it was pressed by the host
however when trying from the client it's inverted
I'm trying to set the image of the objects after clearing the children, its not working. Sorry if it's a dumb thing
doesnt seem like it
? 🤔
You should encapsulate the logic for changing the brush
at the very least create a public function that takes in the new brush / image
then handle the updating inside the widget itself
Usually It's just neater to send all the data to the child widget
The entire S_Items
Like this
then on the sub widgets construct you can directly use this data
Thanks, I'll try to make the changes
Always try to encapsulate the logic of updating things to be within the thing that owns the variable
Keeps it easy to maintain, and bug fixing is just single sourced : )
Along with expanding functionality (Oh, now i want to do X when Y happens) is so much easier
Thanks for the advice!
Nope, read it carefully
One is fps cam the other tps cam
Ye it's mp issue
Not the raycast
I mean I don't know math
But not sure why rotation introduced
And this is why we don’t do multiplayer first kids 😀
Join the club later?
we can struggle together
on the server it's the same value which make sense as the host is the server so both value will be the same but yeah that's on the client where it's messed up
Same value with what?
By same I thought u sync them
I don't do multiplayer "first" as I did a solo game first
Need more solo game, sorry
how many ?
13
why that number ?
why less?
For reference I also don't know if I'm ready for mp
Anyway before diving to mp
U need to make a functional sp with heavy OOP
Not knowing oop = just work on it in singleplayer first
And keep going until you are comfortable
Basically multiplayer is like learning a whole new engine almost
atleast a few concepts , over again
and in bp only you're fairly limited to how you do things properly
The laws of physics go from regular to relative essentially
ends up with a bunch of "delays" and whatnot
But I don't have an issue with oop but rather the networking part is the issue
I believed u have issue with both
no
And I'm not the only one with the opinion
Well I don't want to attack u
But my suggestion stay the same
the only issue I had was I didn't know how to call the parent of a child bp, I was searching through the search bar but the solution was to right click on the node and click on "Call Parent"
Ultimately do what you want but I’d at least try to live in #multiplayer if you’re going this route, read all the pins and such
That's just one tiny little thing
good understanding of OOP is relatively essential
But I do 😄
Not that one can't get out and about without it, but life is far easier with it
How many years have u used unreal?
3 to 4 years but not regularly
You can always learn more ™️
My progress just stalled...
Learn cpp if u r young
So u don't end up like me
Working as delivery driver
Get a job in game dev, up skill
I'm a quarter of century old, so I'm old
thats young
U r at the right age to start
I wish i started 15 years ago
People still hire you at 25 😀
with cpp
Imagine…
Drop Ur game and learn cpp , if I can time travel, I would slap my old self and learn it earlier
When did you start ?
It's essential for multiplayer too
2-3 years ago
And you're better than me, so the age doesn't matter
I've been with the engine for 8 years
oh then that's why 😄
Prly cause he listened to advice 🙃
It's one factor
Already tried but Unreal cpp gets me crazy
time spent in engine > years since start
and the fact that we don't have a free extension by Epic Games for visual studio cpp themselves gets me crazy
I'm glad there's no clock on hours in engine
(Time spent in engine + money) * fwd vector - age
x)
also needs to be in there
And attention span tbh
that too
The age kinda covers that tho tbh
I could've gone far more serious into cpp tho, I'll admit
I havn't done my due diligence
Since i had some prior programming experience with totally unrelated stuff, I just ... went ahead
I know a little, but I’m procrastinating adding it to my current project, so far I tell myself I don’t need it, but I will eventually have to
I'm trying to make it so that when clicking on a part of a static mesh, it will change the material. Since the static mesh is made up of multiple parts with their own materials, I need to check specifically which face was hit. However, it always seems to return 0 for the face index regardless of which part of the static mesh I click. I've got 'advanced collision' enabled and in the static mesh and all of the subgroups under the LOD have collision enabled.
Any ideas?
So how am I supposed to sync those variables if it's not done already dony by the OnRep 🤔
Over time I've forced myself to use it fairly often, which has made me somewhat comfortable atleast
Nice
My current project is made 80% in cpp
with multiplayer, my least favorite part of unreal xD
and the thing i lack the most experience in
Experimenting alot, reading some source code here and there
So if i were quized i'd probably lack some fundamentals 😄
But the basics? Tom Looman and such? I did CS50 so I learned some C and Python, but tbh I only started understanding OOP properly by using UE
I never completed the CS50
I'm like 2 weeks in and its .. meh
Im an automation engineer , so got some experience with ST
And I kinda can read cpp cause I know what it looks like in bp lol
Ah sweet
I've considered picking up a book or two about cpp, but can't really find the time to do any serious reading about it
Any sparetime i got is spent on the project 😛
I have a hard time reading now, after having my brain trained to ingest video content instead lol
Haha that too.
attention span has gotten narrower
damn short format video content
Indeed 😞
That's framerate dependent, you need delta time
I am able to stay engaged in 2h videos (about coding/UE) but yeah that’s kinda max, else I have to break it down into chunks
Why is "Client 0" printing twice ? 🤔
So you can watch unreal livestreams aswell then i guess
I find them painfully long
Yeah, I love those, at least the ones where there’s an actual lesson and not talking about random stuff or the lecturer not knowing wtf he’s doing
Wrong reply but you get it
If strongly recommend #multiplayer for such problems
Feels like the latter is often the case, or they get hung up on some insignificant incredibly specific detail that nobody asked about
Ah well, they try
some is good
I complain louder than I'm meaning to lol Easy to critique them when I got nothing at stake or to show for x)
I have several number of hard references to other BPs, for example in the PlayerController I have hard reference to a specific PlayerState. But for example now I wanted to try another duplicated modified version of that PlayerState and I should have to replace of the references, in PlayerController and other BPs.
To avoid now and in the future to make several amount of changes that slow down development I wonder if I have add my PlayerState reference in... the blueprint function library?
I should avoided from the beginnign this hard ref way but I learned unreal through the process
Is it an option to create a Base playerstate that you run off from?
you still need to fix all the ref issues as they will be new refs
so all old pins will break
if you however have a base one you use, you can just extend and override what you need
other options is the good ol' interface or a component on the Playerstate.
for sure now I have to relink a lot, but I am hoping to find a way that allow me to fast debugging in the future, changing to different PlayerState, Controllers etc
Components can be added to anyone
so I'd suggest considering that
then they can hold states etc by themself aswell 🙂 Interfaces cant
and require explicit implementation per implementing class
I cant find a youtube video that I think it wqas adding the cast in a BP function library
Go the component route instead if you can 🙂
what key word I use for finding a tutorial on this, just "component" ?
Pattym has an example use of component with his Actor Registrarion comp
this is part 2, i'd perhaps suggest start at part 1
Actor Components are basically reusable script modules that you can attach to any Actor class
any class, so if I create a component with my casting to a specific PlayerState
I should be able to use this component in my BPCharacter, PlayerController, GameState, etc right?
(you wouldnt cast to your specific playerstate)
and then if I need to test anothe different PlayerState, I just either change the component or create a new one
you'd want to stay as independent as you could 🙂
Any Other actor that needed access to this would simply do
SomePlayerStasteRef -> GetComponentByClass(MyComponentClass) -> DoThing()
I am not sure if I understood correctly.
This part
SomePlayerstasteRef -> GetComponentByClass(MyComponentClass)
If its a single player game you can mostly just use the static "GetPlayerState()"
in my Bp Character right now I am casting to PS_Fight lets say
and I want now to test PS_FIght2
problem is that this little change is fine but I have several references to PS_Fight in different BPs, from GameState to PlayerControllers
I want a way to change the reference to PS_Fight to Ps_Fight2 in the fewer steps possible
and this PS_Fight (and its slightly changed duplicated PS_Fight2) has specific variables than I am accessing, thats why I was casting as Cast to allows me that
And I'm saying, if you extract your logic from PS_Fight and move it into a AC_Fight , then this can be put on any PlayerState and it will simply work
ah
Assuming the Component can hold all the necessary info ofcourse. which it probably can
you'd still need to fix your references once , and refactor the code to live inside a Component,,
but aside from that all future changes to PlayerState classes will be effortless
I get it now, to move all the code from PS_Fight to the component, and then everytime I am "Casting to PS_Fight" just to say "Get PlayerState" then "GetComponent that I created" and from there I can get all the variables (and logic that I moved inside there)
is there any limitation in performance or multiplayer implementation (I am planning in some moment) that I should have in mind?
-
to use a Component
to move all the code from PS_Fight to the component, and then everytime I am "Casting to PS_Fight" just to say "Get PlayerState" then "GetComponent that I created" and from there I can get all the variables (and logic that I moved inside there)
if I need to test anothe different PlayerState, I just either change the component or create a new one -
or a Blueprint Function Library
where I Cast to PS_Fight
and in case I need to test another PlayerState, I just change it there
Nothing to think about at all
the latter requires you to still fix all the references
as the old links depends on the old Playerstate
the former does not, as the component remains the same, regardless of which playerstate is used (as long as it inherits from playerstate)
ok thanks!
I think I cant add an actor component to a GameInstace, right?
I was thinking to do the same with my GameInstance, instead of using Cast to get variables
@faint forge GameInstance is actually not an Actor
So you can't add components to it
Also what is your solution to actually get the component if you are trying to avoid casting?
GetComponentByClass and similar stuff is probably more expensive than just casting. And an Interface does in fact cast.
So even if you use a Component you'd probably need to cast. Which is totally fine.
But I haven't read the conversation, so might be redundant info
I just want a fast way to change my cast to ... diferent PlayerState
maybe I should just use a Blueprint Macro Library?
What do you mean by that?
The cast is avoided to decouple the classes
So they dont rely on thatSpecificPlayerState
So they want to change the PlayerState in the GameMode and it should still just work?
Its mot the cast per'se but the hard link
Thry want to change to an unrelated playerstate, yes
If their logic resides in the comp, all they gotta do is add the comp to the new PS
That's a strange thing to do.
I have many references to a specific Player State, called lets say PS_1
but I want to try some changes, so I duplicated and renamed as PS_2
with some changes
Oh buddy
but all my several references along my BPs go to PS_1
Changing class? Yes. Component to decouple? I wouldnt say thats so weird ;p
Yeah base class was suggested
The class part
Drawback would be if you add Marketplace asset tonit that requires you to use their PlayerState etc..
Then component has an advantage in my book
The reason you are struggling is cause you are doing it wrong.
If you want to slightly alter logic of PS1, make PS1_Child and override the functions you want to alter. Or change the variables in it. The casts to PS1 will still work fine then
Duplicating to PS2 is not really a solution. The way the GameMode and Game framework classes are structured makes it somewhat needed that you stick to a PlayerState class in your given GameMode and if at all move down the inheritance chain
You can use the Components, sure
Then use an Interface fwiw to grab the component
Some BPI_PlayerStateComponentGetter that just has a function to get the Component
And implement that in the PS1 and PS2 and return the component thete
Im lazy with that 🤣 just using getCompOfClass
Then you can do GetPlayerState and call the interface function on it
I mean sure, you can do that too
Your code :P
What does the interface bring to the table? :p
Simple Cast + Get vs searching the whole component list
hmm
I need to digest all this, but would be possible
just to add the Cast to MacroLibrary
and then replace this macro for the Casts that I made
If you do this once to get the component then it's totally fine
Like if you init something and you need to get some movement component of an actor, or a mesh component of it.
But if you need to get the mesh comp in 40 places, I would use an interface
Yeah but how does that scale tbh