Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How to Save / Load Obi Actors in 5.0
#20
Hi!

So what i'm trying to do is actually pretty similar to what Elegar was trying. Running the game on editor i want to be able to move the rope and making a new path for it. After that, save the new path in a new blueprint and use it for a new start of a scene or in edit mode use the "Edit Path". I made a code that almost met my needs, but unfortunately the new blueprint is not "syncrhonized" with the new path, the rope follows the path, but i can't use "Edit Path" on it. I will let some prints to demonstrate my problem and the piece of code that i used. I actually dont't know if is possible to do what a want, but will be glad with any answer even if is just a tip to improve the code.

   
   


Code:
    public bool SaveNewBluePrint()
    {
        ObiActorBlueprint presetBluePrint = ActorBlueprint(rope);

        string path;
        string newPath;

        path = AssetDatabase.GetAssetPath(presetBluePrint);

        newPath = CreateNewPath(path, presetBluePrint.name, newBluePrintName, ropeOrRod);

        if (!AssetDatabase.CopyAsset(path, newPath))
            return false;

        if (ropeOrRod)
            newBluePrint = (ObiRopeBlueprint)AssetDatabase.LoadAssetAtPath(newPath, typeof(ObiRopeBlueprint));

        else
            newBluePrint = (ObiRodBlueprint)AssetDatabase.LoadAssetAtPath(newPath, typeof(ObiRodBlueprint));

      
       rope.SaveStateToBlueprint(newBluePrint);
       AssetDatabase.SaveAssets();

     
        return true;
    }
Reply


Messages In This Thread
RE: How to Save / Load Obi Actors in 5.0 - by Marco Fonseca - 17-07-2023, 08:30 PM