Example #1
0
    private void OnRecordingButtonClick()
    {
        recordingTimeText.text = StartTimeText;
        switch (state)
        {
        case State.Idle:
            if (!recorder.IsRecording)
            {
                recordingStartTime = Time.time;
                recorder.StartRecording(true, true, false);
                recordingButtonText.text   = RecordingButtonStopRecText;
                recordingButtonImage.color = Color.red;
                state = State.Recording;
            }
            break;

        case State.Recording:
            if (recorder.IsRecording)
            {
                recorder.StopRecording();
                AnimationClip clip = recorder.SaveRecording(DataFilePath, false);
                AssetUtil.CreateAsset(clip, AnimationClipsFolderPath, AnimationClipName);
                OverrideAnimationClip(RecordedClipKeyName, clip);
                Debug.Log(GetType() + ".OnRecordingButtonClick: animation clip saved to " + Path.Combine(AnimationClipsFolderPath, AnimationClipName));
                cancelReplayButton.gameObject.SetActive(true);
                recordingButtonText.text   = RecordingButtonPlayText;
                recordingButtonImage.color = Color.white;
                state = State.RecordedIdle;
            }
            break;

        case State.RecordedIdle:
            // start replay
            recordingStartTime       = Time.time;
            recordingButtonText.text = RecordingButtonStopText;
            replayText.gameObject.SetActive(true);
            SetTrigger(TriggerName.recorded);
            state = State.Replay;
            break;

        case State.Replay:
            // stop replay;
            recordingButtonText.text = RecordingButtonPlayText;
            replayText.gameObject.SetActive(false);
            SetTrigger(TriggerName.idle);
            state = State.RecordedIdle;
            break;

        default:
            break;
        }
    }
        public void Generate()
        {
            //If this object is not an asset
            AssetUtil.CreateAsset(RootFolder, this);

            //Create the Runtime Resources folder if it doesn't already exist
            AssetUtil.CreateFolder(RuntimeResources);

            if (RuntimeData == null && !EditorApplication.isPlayingOrWillChangePlaymode)
            {
                _runtimeData      = CreateInstance <CharacterData>();
                _runtimeData.name = InternalName + RuntimeDataSuffix;
                AssetUtil.CreateAsset(RuntimeResources, _runtimeData);
            }
        }
Example #3
0
        public static void CreateStyleSheet()
        {
            var o = AssetUtil.CreateAsset <StyleSheet>();

            AssetUtil.SelectAssetInProjectView(o);
        }