#๐ญ
1 messages ยท Page 1 of 1 (latest)
Balls. What is it you're trying to do? Might be another way around it
Just call the get actors of class function?
can't do it in an object
what you need world for ?
I am trying to create like a component for level blueprint so it can stay isolated and filtered however level blueprint can't have components so I thought of using object but the object doesn't have access to the world freely
why do you want a component on level blueprint ?
using level blueprint is usually not recommended
I am basically trying to get a specific component from all the actors in the world and set them up. Since this acts as global variable which they all use to submit and receive orders from
I think you want to look into a GameState class potentially?
I wanted something that persists through out the level
Or, a world subsystem
I will have to look into both of these things
many things persist throughout the level
game mode, game state
hud, a manager actor
any actor you don't remove from the scene should be "persistent"
I see I will look into those. I basically wanted this to work closely with the game saving system and I though something like this would seem better
Ok yeah, you definitely want a GameInstance, GameMode or GameState class.
My game saving logic usually lives in the GameInstance as it's available from the moment your game starts
I am basically creating a component that specifically stores the current progress of the game and its objective to the save system so I needed it to be somewhere from where it can be accessed easily and I only know about gameinstance and levelinstance to store things globally
but the problem with this is that this needs the reference to the world as well since its the one doing the saving and not just getting called by the world but sadly game instance being an object doesn't have reference of the current level
so it can only get called by the world and can't directly interact with the world
what do you need to interact ?
the game instance is the only thing that persists through multiple levels
like here when I try to get all the actors in the world
so your pretty much stuck with it
get all actors of class
is all in the world
yes and it doesn't work in the object that is the problem
are you saying you need world context ?
you can pass any actor
I have to go for now. Thank you for the help so far
this is a blueprint function library
you need to world context
and you just pass any actor in
Allow me to elaborate on what I am doing. I am creating a component(isolated part) whose only job is to store the progress of events that are currently waiting to be completed and the ones that are completed. So it basically saves the current state of the gameplay and not the player itself. Its only task is to load the level's state to what it was before quiting/saving the game. As just it needs to be binded to the level alone as it needs to only work when the level begins or when the player quits the level. And as this component is responsible for loading the state of the gameplay at runtime it needs to get the reference of the world to set it as per saved data and thats why it needs the world reference.
"you cannot directly attach a component to the "world" in Unreal Engine because components are designed to be attached to other components or actors" -AI
As for this I've already tried it but I guess its bug in unreal that function library's change doesn't get updated too quickly for now I am about the game state and world subsystem for now. and then I'll decide where exactly to attach this componenet
yes that why I am using an object so I can store it in a variable
so ig you can have a save for each level
and for where I should store it, in level blueprint, gamemode or if any other place is recommend please do tell.
i don't understand what it's storing ?
what is thing even doing ?
wdym the levels state ?
at each level the component needs to load the state from the save file so each level needs either their own such component or they need to call it it every time in the game state
noob question. why we cant just put actor in level -> add component to this actor -> craete some dispatchers/interfaces to tell him when to do his saving stuff?
yes a amanager actor you can defiantely use, but each level would require a custom one
definately not the level blueprint
basically if player has a bunch of objectives. Its storing which ones have been completed and which ones are next as well as which subsequent areas has been unlocked a result of completing the old objectiv3es
idk why you need world
just an array of objectives would be fine
make an objective struct, make an array, flip a boolean on completed
Becasue the checkpoints that monitoring the progress of the player are present on the world
and they needs to be adjusted to the saved state when the saved file is loaded
well idk about the saving/loading part that may need world
I am not mearly monitoring them but also managing them telling them when to be active and when to be dormant
but it doesn't sound like you need world at all
it's not a component
it would just be some functions
unless you use a manager actor
like mentioned you can do that
Thats a valid approach that I found online but that sounds like an overkill
at which point you would attach the component
hm. i have checkpoint. but they save rn only character/chest position. Just put it in world. and the contact my BP_SaveGame. thats all
yeah let says its some function but where to store them
it's very common to save stuff
Mine is a bit complex
so there was pleanty of places i mentioned and others did as well
yy. my save system is too simple. cos then i've tried save items/skills/stats -> all die ๐
For now I'll look into world subsystem and game state
otherwise I'll store it in gamemode
just literally "game state" the state of the game