Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to set relaxed state on first frame? (Sth. similar to prewarm?)
#3
Thanks for your quick reply, sounds great, but I am not getting it to work exactly as expected.

This is the script and a video trying to execute it. I do the entire process twice, on the first try it does create a new blueprint with the correct name but after assigning it the inital state does not change, then I execute the function again writing to the current state to that same currently selected initializedbp blueprint and then it keeps that state while not in play mode but as soon as I hit play it resets back to the original state.



(note: the newly saved blueprint does not have definitions for attachment points, you still need the old blueprint too)
Code:
using UnityEngine;
using UnityEditor;
using Obi;

public class Test : MonoBehaviour
{
   public ObiActor actor;

   [ContextMenu("SaveBpState")]
   void SaveBpState()
   {
       var passThisOne = Instantiate<ObiActorBlueprint>(actor.blueprint);
       actor.SaveStateToBlueprint(passThisOne);
       AssetDatabase.CreateAsset(passThisOne, "Assets/initializedBp.asset");
   }
}

btw I use CreateAsset to save a new copy of the passThisOne blueprint, because I noticed that when I ctrl+d duplicate a blueprint asset it is not a straight copy, but turns into a container instead?
[Image: bWeNtrU.jpg]
Reply


Messages In This Thread
RE: How to set relaxed state on first frame? (Sth. similar to prewarm?) - by fleity - 27-04-2020, 04:04 PM