diff options
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/parallax_layer.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp index a5a59252a9..debdc22b65 100644 --- a/scene/2d/parallax_layer.cpp +++ b/scene/2d/parallax_layer.cpp @@ -36,6 +36,9 @@ void ParallaxLayer::set_motion_scale(const Size2 &p_scale) { motion_scale = p_scale; + if (!get_parent()) + return; + ParallaxBackground *pb = get_parent()->cast_to<ParallaxBackground>(); if (is_inside_tree() && pb) { Vector2 ofs = pb->get_final_offset(); @@ -53,6 +56,9 @@ void ParallaxLayer::set_motion_offset(const Size2 &p_offset) { motion_offset = p_offset; + if (!get_parent()) + return; + ParallaxBackground *pb = get_parent()->cast_to<ParallaxBackground>(); if (is_inside_tree() && pb) { Vector2 ofs = pb->get_final_offset(); |