Child Actor messes the parent character movement - unreal-engine4

I'm trying to use child actors in the following way: I have my main character with a child Actor, I want that to be the chasis for my ship, this will have some functionality so having it as a BP should work fine. The chasis will also follow the same principle and I want to attach different mods to the chasis but first I want to use the bare chasis inside my character.
However, when I select my chasisBP in the child Actor my character stops moving. This is only when the child Actor is setted. What I had before was just a static mesh and with that I can move freely.

Related

SpriteMask in Unity

There are many identical objects, each of which has a child.
The child object must not appear outside of the parent. I do this using SpriteMask, but with this approach, the child object sees within the boundaries of someone else's parent, as in the screenshot

Can't pick StaticMeshActor from scene when I create variable of that type in blueprint, if the actor is from sub-level in Unreal Engine 5

I have made an blueprint and inside of it, variable of type StaticMeshActor (object reference):
When I create instance of this blueprint in scene, I get the drop-down for my “Test” variable with StaticMeshActor actors in scene (that’s correct).
But once I click on any of them (that are from sub-levels), field resets to “None” again. Same goes for picker icon from scene.
Is it bug, or am I doing something wrong? Is it even possible to select actor from sub-level?

access a variable from level blueprint in unreal engine 4

I Have a variable that updates every time i move my cube in the level blueprint , now i want to access this variable from multiple class blueprints , what do I do , I tried casting to gamestate but didn't succeed , I am really new to ue4 if you could explain in details please
edit: sorry for not adding details ,
The var I want to access is an integer named cube_side that tells me what side the cube is on every time I move , all of this happens in the level bp , I want to access this variable to see what side the cube is on from other class blueprints ->
here are some details in a picture
I know it's not good to code everything in the level blueprint , but it's too late now , I only need to transfer the var cube_side to other class blueprints so the other object can change depending what side the cube is on.
Create an Actor Class for your logic/functionality. Then use Get all actors of class (choose your class) -> Get a copy -> get variable
Communication with the level blueprint is rather tricky in UE4, since they are not as persistent as e.g. the GameMode, and therefore shouldn't be accessed directly (Imagine older games like Final Fantasy where a new level was loaded every time you stepped outside a boundary, so relying on it could potentially break your actors or crash the game due to nullptrs).
It's a little hacky, but works:
Move the variable inside the cube-blueprint. Add an event dispatcher to the cube, if it is moved, call it and pass the variable in.
Select the cube in the editor, open the level blueprint, right-click, "add reference to selected actor" (the cube must be part of a blueprintclass, not only a static mesh dragged in, though), and bind the event dispatcher inside the Level BP.
Create a function inside every blueprint that needs access to the variable, which does whatever it should do, depending on the variable.
The custom event of the Level Bp (that was bound to the Event Dispatcher of the cube), needs references to all actors that have to work, when the variable changes and call each Actors function (you can get the references like you got the one from the cube)
Then, every time the variable changes, the Level BP is notified, the custom Event is executed and this custom event calls all the actor's functions.
Event Dispatchers explained
This is a huge wastage of functions/code, since you only need it for this one level and may never use it again. Avoid this in the future, by not relying on the level BP so much.
You can use GameStateBP to create and store all variables that you need in game, in GameModeBP create functions to get and set this variables via Get Game State function and then function Cast To GameState and then logic. After that from any blueprint access it using Get Game Mode -> Cast to you GameMode -> use your function to set or get data from GameState.

Unity, Spawn a prefab from another prefab

I'm new to Unity. I have an invisible GameObject , call it A, with only a script, that instantiates a prefab B multiple times. I need spawned clones of B to have reference back to A, I have learned that in order for this to work, A has to be a prefab itself (correct me if I'm wrong) Spawned B objects react to mouse clicks and call a method of A. The problem is that inside this called method of A, the variables of A itself have values that I don't expect, for example a certain variable that was initialized to 0 in Start() and never used has a value of 12. It seems like every spawned object B has a reference to its "own" A, and variables of A have random values. What am I missing?
in order for this to work, A has to be a prefab itself (correct me if I'm wrong)
I assume that you are setting the relevant field in the script on prefab B to the prefab of A, which is not what you want. A doesn't have to be a prefab at all.
A prefab is a serialized GameObject that contains specific shared default values for easy GameObject management through the Editor and Editor/in-game scripts. A prefab is used when dealing with a large number of similar objects; each prefab instance will be similar to another with the exception of a few modified properties. This allows for large scale instantiation modification of prefab instances in a single click. For example, storing a gun projectile object as a prefab allows you to modify the default size of all gun projectiles with a single click, while allowing for property customization on a per-instance basis. You can think of prefabs as templates you can use to instantiate a GameObject.
When spawning an instance of prefab B through the script on A (henceforth referred to as ScriptA), simply set the required field on the script on the spawned instance of B (hereafter referred to as ScriptB) to the gameObject (or some other) field of ScriptA, like the following:
// ScriptA's method which spawns instances of prefab B
GameObject bInstance = Instantiate(prefabB);
ScriptB scriptOnBInstance = bInstance.GetComponent<ScriptB>();
scriptOnBInstance.referenceToAGameObject = this.gameObject;

Run action only on parent sknode

As title says. How to run SKAction only on parent only (children not affected by it)?
I have some SKSpriteNodes with children, but I would like to manually control which actions are run on each children and that actions are not inherited from parent
SpriteKit does not work this way. If your children should not be affected by the parent's movement, perhaps you should reconsider making them children.
However, there is a fun workaround: run an action on the children that counteracts the parent's movement. For example, if you run an action on the parent that moves to the left, run an action on all the children that moves them to the right simultaneously.