I add a Actor Group in my Cutscene.
When I export the Cutscene root node to a prefab file(not include the ActorGroup’s actor GameObject), then delete this Cutscene root node from this scene.
And import this prefab to the same scene,event the ActorGroup’s actor GameObject is still in Scene, but the Cutscene ActorGroup’s GameObject reference is missing.
How to Export to Cutscene Prefab with right GameObject reference?
Do by export, you mean export to .unitypackage?
If so, this is not possible to include the reference of the gameobject in the package, since the gameobject lives in a unity scene (which is not included in the .unitypackage).
This is simply how unity works unfortunately.
Did I misunderstood the problem? Please let me know if so.
Thank you.
I’m not mean export a .unitypackage.
Just mean I want save the Cutscene GameObject node to a .prefab file.
If the Actor GameObject is not the Cutscene GameObject’s child, then when I was instantiation the Cutscene prefab, then the Actor GameObject is missing.
It’s means the Actor GameObject I have to set to Cutscene GameObject too it’s parent?
Or the Cutscene GameObject should not be a prefab?
Thanks for explanation.
Ideally, the cutscene is better to NOT be a prefab since it is entirely a scene based object and relates to scene objects as well.
Alternatively, if you do have a prefab cutscene and instantiate it in runtime and want to re-assign Actor GameObjects as required, you can use the cutscene function called “SetGroupActorOfName(string groupName, GameObject newActor)”. For this to work better, you will of course have to name your Actor Groups in the inspector (by selecting the group) so that you can easily use this function better.
This reference limitation is generally speaking how Unity works, in that asset objects (like a prefab) can’t have references to scene objects.
With that said, I am already looking at finding a way to easier handle this situation, probably by automatically fetching the object by specified name if a reference is missing.