Instead of Get every time, why not put in variable?

I am very curious about efficiency in this case.
In this video we are Getting the Parent Attached and Casting it every time that we put our hand in the climbable object.
Why not to put in variable when setting the controller? Would it be less efficient?

In some cases, it would be preferred. Using a variable should be more efficient but it does depend on the circumstance. A cast operation isn’t costly and neither is getting the parent but again, if you had a massively code heavy app, this could result in frames dropped and issues around that and then it becomes important. Every cycle saved can make a difference.

I would say experiment and if your solution works, share it.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms