# Reparenting May Cause Data Loss

**URL:** <https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974>\
**Category:** Community & Industry Discussion\
**Tags:** parent, instance, parenting, unreal-engine, question\
**Created:** [August 15, 2017, 2:59am UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974 "2017-08-15T02:59:27Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_0746fae6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0746fae6](https://forums.unrealengine.com/u/anonymous_user_0746fae6)\
**Post date:** [August 15, 2017, 2:59am UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/1 "2017-08-15T02:59:27Z")

</div>

I have a BP only project. All my plugins are installed in 4.16/Engine/Plugins/Marketplace/…/

I try to reparent one plugin GameInstance with another plugin GameInstance. I try both ways (vice and versa). I always get the Data Loss error. When I reparent, one just turns into the other.

I want to use both!

---

<div class="post-metadata">

**Author:** ![vorixo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vorixo/32/918682_2.png) [@vorixo](https://forums.unrealengine.com/u/vorixo)\
**Post date:** [August 15, 2017, 2:58pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/2 "2017-08-15T14:58:28Z")

</div>

You cannot have two parents in inheritance. For that you may want to to an inhertance chain. GameInstance1 → GameInstance2 → YourGameInstance. It is not a very good solution but you will be able to have all the functionalities from the parents in your child.

---

<div class="post-metadata">

**Author:** ![vorixo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vorixo/32/918682_2.png) [@vorixo](https://forums.unrealengine.com/u/vorixo)\
**Post date:** [August 15, 2017, 3:06pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/3 "2017-08-15T15:06:37Z")

</div>

You can decide which one will be the parent and do a simple reparent from one to the other, or just merge behaviour on a single file. You will only want to use inheritance when you will have different Game instances for different situations.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0746fae6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0746fae6](https://forums.unrealengine.com/u/anonymous_user_0746fae6)\
**Post date:** [August 15, 2017, 3:08pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/4 "2017-08-15T15:08:59Z")

</div>

I’m sorry but I just don’t get what you’re saying.  
Make three GameInstances, one is UGameInstance.  
Reparent UGameInstance to a GameInstance…then reparent the final GameInstance to the UGameInstance which had its parent changed? It just doesn’t work.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0746fae6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0746fae6](https://forums.unrealengine.com/u/anonymous_user_0746fae6)\
**Post date:** [August 15, 2017, 3:12pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/5 "2017-08-15T15:12:26Z")

</div>

Reparent one GameInstance to another GameInstance does not leave me with all the functionalities from BOTH GameInstances.  
Might I need to merge both to one single file? \<— How do I do it?

---

<div class="post-metadata">

**Author:** ![vorixo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vorixo/32/918682_2.png) [@vorixo](https://forums.unrealengine.com/u/vorixo)\
**Post date:** [August 15, 2017, 3:16pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/6 "2017-08-15T15:16:08Z")

</div>

No, UGameInstance is the Unreal Engine base GameInstance, you shouldnt reparent that at all. You may need to have an structure like this one in terms of inheritance UGameInstance as the base parent, then one child and another one inheritating from that child.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0746fae6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0746fae6](https://forums.unrealengine.com/u/anonymous_user_0746fae6)\
**Post date:** [August 15, 2017, 3:17pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/7 "2017-08-15T15:17:24Z")

</div>

So how do I do it? x)  
My project is BP only. You’re saying convert to C++? Edit a GameInstance C++ class to change it from UGameInstance to another GameInstance class?

---

<div class="post-metadata">

**Author:** ![vorixo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vorixo/32/918682_2.png) [@vorixo](https://forums.unrealengine.com/u/vorixo)\
**Post date:** [August 15, 2017, 3:18pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/8 "2017-08-15T15:18:14Z")

</div>

To merge both in the same file you may want to reprogram the behaviour you have in one in the other one. And yes, inheritance will give you what you need, take a look at the concept of inheritance in OOP.

---

<div class="post-metadata">

**Author:** ![vorixo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vorixo/32/918682_2.png) [@vorixo](https://forums.unrealengine.com/u/vorixo)\
**Post date:** [August 15, 2017, 3:19pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/9 "2017-08-15T15:19:54Z")

</div>

No, im not saying that, im speaking in a BP’s background. Im saying to take one of your GameInstances and reparent to the other one which is child of UGameInstance.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0746fae6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0746fae6](https://forums.unrealengine.com/u/anonymous_user_0746fae6)\
**Post date:** [August 15, 2017, 3:20pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/10 "2017-08-15T15:20:52Z")

</div>

I don’t really understand what you say. Can you show me with blueprints?

---

<div class="post-metadata">

**Author:** ![vorixo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vorixo/32/918682_2.png) [@vorixo](https://forums.unrealengine.com/u/vorixo)\
**Post date:** [August 15, 2017, 3:23pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/11 "2017-08-15T15:23:59Z")

</div>

In this video Mathew explains what inheritance is, take a look:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/f/6/8f61de6dda19deb4ad85625d772d694172e698ec.jpeg "WTF Is? Child and Parent") ](https://www.youtube.com/watch?v=tCO0FdibECc)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0746fae6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0746fae6](https://forums.unrealengine.com/u/anonymous_user_0746fae6)\
**Post date:** [August 15, 2017, 3:27pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/12 "2017-08-15T15:27:17Z")

</div>

So I make a GameInstance, then create a ChildBP of it. Then reparent that to my other GameInstance?

---

<div class="post-metadata">

**Author:** ![vorixo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vorixo/32/918682_2.png) [@vorixo](https://forums.unrealengine.com/u/vorixo)\
**Post date:** [August 15, 2017, 3:29pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/13 "2017-08-15T15:29:51Z")

</div>

If both game instances that you have inheritate already from UGameInstance you dont need to create anything, just reparent one to the other. Have in mind that if you have duplicated functions they may conflict

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0746fae6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0746fae6](https://forums.unrealengine.com/u/anonymous_user_0746fae6)\
**Post date:** [August 15, 2017, 3:29pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/14 "2017-08-15T15:29:59Z")

</div>

It doesn’t work. I’m trying to combine two GameInstances not Mathew’s actor Blueprints. lol

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0746fae6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0746fae6](https://forums.unrealengine.com/u/anonymous_user_0746fae6)\
**Post date:** [August 15, 2017, 3:30pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/15 "2017-08-15T15:30:58Z")

</div>

They are both UGameInstance types. Not Platform. But reparenting doesn’t allow the first one to be used. In vice or versa. None of functions are the same.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0746fae6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0746fae6](https://forums.unrealengine.com/u/anonymous_user_0746fae6)\
**Post date:** [August 15, 2017, 3:31pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/16 "2017-08-15T15:31:44Z")

</div>

What do you mean inherited from UGameInstance?  
Both appear when I search “GameInstance” but I know in 4.16/Engine/Plugins they both have “Source” folders and .cpp and .h files.

---

<div class="post-metadata">

**Author:** ![vorixo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vorixo/32/918682_2.png) [@vorixo](https://forums.unrealengine.com/u/vorixo)\
**Post date:** [August 15, 2017, 3:32pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/17 "2017-08-15T15:32:22Z")

</div>

Inheritance is the same in all contexts when you are working with OOP. I sent you the video to understand inheritance, not to copy and paste what he is doing. Enter Unreal Slakers and ask in #programming, we will be able to help you better there. Its a chat, just google it.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0746fae6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0746fae6](https://forums.unrealengine.com/u/anonymous_user_0746fae6)\
**Post date:** [August 15, 2017, 3:32pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/18 "2017-08-15T15:32:49Z")

</div>

What is OOP? I’m not inheriting anything.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0746fae6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0746fae6](https://forums.unrealengine.com/u/anonymous_user_0746fae6)\
**Post date:** [August 15, 2017, 3:33pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/19 "2017-08-15T15:33:49Z")

</div>

I’m not stupid. I have used Child and Reparent before. When I create one GameInstance and reparent, it breaks the GameInstance. There is Data Loss.

---

<div class="post-metadata">

**Author:** ![vorixo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vorixo/32/918682_2.png) [@vorixo](https://forums.unrealengine.com/u/vorixo)\
**Post date:** [August 15, 2017, 3:33pm UTC](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974/20 "2017-08-15T15:33:57Z")

</div>

OOP is Object Oriented Programming, and yes you are already doing inheritance because your GameInstances are childs of UGameaInstance

[Next page](https://forums.unrealengine.com/t/reparenting-may-cause-data-loss/401974.md?page=2)
