so, it’s convenient but i wonder is
this ok? is there probably Problems?
I would not call it convenient (perhaps in a tiny project it could be) but there should be no problems if you’re treating them with care. This is not a great practice in the long run and there is generally no need for this if you set things right.
Now that you know how direct references work, perhaps look in to Event Dispatchers. And then into Interfaces. Once you see how these work, you’ll notice how redundant / dangerous and unnecessarily complex storing direct references can be.
Imagine what happens when you have 1051 puzzle blocks in the Level Blueprint. Let’s say they all need to talk to the Player Controller but you probably don’t want to crate 1051 references, right?
Instead you could have an event in the Player Controller:
Notice that there’s not a single hard direct refence here, yet every time I click the actor, the controller is notified and knows precisely which actor was clicked and with which button. And if one of those actors gets destroyed, no biggie; no error messages, no null pointers.
Try destroying a hard-referenced actor and access it again, see what happens.
Essentially, there is no one way of communication. You pick the best tool for the job.
indeed i looked into event dispatcher and interfaces, but they seems needed ref target
because i’m clumsy yet, i can’t figure it out how can i get that references.
so i think that i need something a relay station. so…it was player controller.
(actually, i’m still confusing even in using of interfaces, and dispatcher. they seems good talking methods once i can get who am i talking to but… as you see still i’m in confusing for ref)
i’m in studying unreal so i didn’t think that huge case. as you said it seems quite dangerous if i did it to everything. but then it’s ok for few things that i can care. right?
i’m experimenting grid based building game, i need grid reference when i do (click build) in build mode.
because i made (vector to grid) function and (Show Grid Block Preview) function at grid actor.
when i in build mode, i trace under my mouse cursor and find vector and calculate it to coordinates in grid for snap place building block but i should cast trace result and bring calculate function from grid every time.
i heard cast is expensive (from tut videos, i don’t know why because trace results seems small results)
i think i need it once. i decide these
as you said there is no only one way, so i could implement calc function to camera actor