Why UE4 tells me that i don't have to "cast to" but when i dont it just give me errors?

It makes sense, perhaps you forgot this:


Creating a variable is not enough, you also need to assign it value. In this case the value is a particular object that exists in the world. Without value the reference is null - not pointing at an object; that’s the error you’re seeing.

If you had 3 oceans, how can the editor know which one you mean. You need to tell it which instance of the Ocean actor you want to reference in that variable. This is true even if you have only one instance of Ocean.

Similarly, lets say you want to store player’s health in a float variable. You create a variable and then set it to some value - 100, for example. Otherwise player’s health would be 0.

When it comes to casting, it’s not a form of communication - think of casting as a test. You’re testing whether an object is of specific type. If you already have a variable of Ocean type, there’s no need to cast it to Ocean type again.

hi, i am new on UE4, and im trying to call/exec a function from another BluePrint. When i try to reference the blueprint with a variable type “Object Reference”, it does not work and throws me a bunch of errors when i press “play”, but then, when i try to cast to the Blueprint it shows me a message telling me that i dont need to cast it… Does that make any sence?

as i said, im new on UE, so maybe im just doing all wrong… if is so, can you help me understand how to exec the function right?

By the way, i followed this tutorial and for him it worked just fine… Unreal Español. Flotabilidad sin C++ (solo BP). Buoyancy only BP 2/2 - YouTube

Minute : 20:05

Tick event fires faster than promoting variables … so you can use( Get all actors of class) and call your BP and connect that to the tick event… and will work fine

Thank you, you are right… I forgot to assign the variable value…