Access Specifier

I was just told in a tutorial that when we don’t want to allow any other actors to have access to this character blueprint we set Access Specifier to private. However I though all blueprints were made to only access a certain actor unless we go out of our way to access more than one actor?? I must be missing something here? Thanks.

Or is it to separate blueprints for the same actor?

Where was it where they wanted you to check this option? I honestly have no idea why they’d want you to set it to be private, I have never needed/cared to set anything to private in my 6 months of using UE4. Could you link me to the tutorial?

Hi ! It is actually with digital tutors so I am unable to link it. It is in regards to setting up a bullet tracer to see the direction a bullet is traveling? I’m follow the FPS tutorial step by step, but maybe this is not of importance?

This is the link, but I’m pretty sure it will block access. Worth a go.

http://www.digitaltutors.com/tutorial/2074-Scripting-a-First-Person-Shooter-in-Unreal-Engine#play-49369

If your the only Developer or more importantly, designer working on the project. Then setting more restrictive access modifiers on your variables/functions can be pointless sometimes, since you already know when/where you will want to use something and for what reason that it might not be able to be used in a particular scenario.

However it becomes very important to worry about access modifiers when you are working on a project with multiple people, especially designers and other programmers. For example if you have a function that directly modifies some attributes on an Actor for a specific reason and it shouldnt be used outside of the owning class, having it set to public could be dangerous and create bugs when another designer or programmer who may not have wrote that particular function thinks that it will perform a task that they need to complete, when infact you intended that function to only be used in a specific case.

Access modifiers is all about protecting data from outside sources that may not need to use its functionality or understand how the function has been implemented.

Well in that case I am not sure why they have you do that, you should probably be fine without checking the option, as making something private just restricts your own ability to be able to access something. What exactly do you mean when you say setting up a bullet tracer?

Edit: Like DevilsD mentioned, it really is all about protecting data so that others don’t accidentally modify it.

So if someone uses the function is it nonexistent or do they simply need to check it to public if they want to use it. I guess what I’m asking is there a way for someone else to use it in another place or is it a one time thing for the function being used? When set to private that is.

The bullet tracer is along the same lines as this.

https://www.youtube.com/watch?v=7krvAVH3ZqA

However since it is a tutorial it looks like a long red laser that lingers for a few seconds.

Setting a function or variable to private will restrict its use/access outside of its owning class/blueprint.

The function/variable still exists and can be used/modified but only by its owning class.

Setting something to public gives full access as long as you have a reference to it.

Ok gotcha. Thank you!

Oh yes, that is simply a projectile with a pretty material on it, the red lasers are debug lines/line traces. If you have a blueprint “MY BLUEPRINT”, and it has a variable that is set to private, you can’t set that variable from any other blueprints, while you would be able to if it was public. It will likely just throw an error if you try to modify a private/protected variable.

Ok cool! Most of the blueprints are going over my head.I believe through not only copying but trying to understand the process it will help me out in seeing the bigger picture. Everything in time. :slight_smile: