Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


## [2.6.12] - 2022-02-15
- Bugfix: Standalone profiler no longer crashes with CM.
- Bugfix: EmbeddedAssetProperties were not displayed correctly in the editor.
- Timeline guards added to scripts that rely on it.
- Regression fix: Axis input was ignoring CM's IgnoreTimeScale setting.


## [2.6.11] - 2021-10-05
- Bugfix: OnTargetObjectWarped() did not work properly for 3rdPersonFollow.
- Bugfix: POV did not properly handle overridden up.
Expand Down
7 changes: 4 additions & 3 deletions Editor/Helpers/CinemachineTriggerActionEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ bool DrawActionSettings(SerializedProperty property, bool expanded)
if (isBoost)
EditorGUILayout.PropertyField(property.FindPropertyRelative(() => def.m_BoostAmount));

#if CINEMACHINE_TIMELINE
bool isPlay = actionProp.intValue == (int)CinemachineTriggerAction.ActionSettings.Mode.Play;
if (isPlay)
{
Expand All @@ -97,7 +98,7 @@ bool DrawActionSettings(SerializedProperty property, bool expanded)
InspectorUtility.MultiPropertyOnLine(
EditorGUILayout.GetControlRect(), null, props, sublabels);
}

#endif
if (actionProp.intValue == (int)CinemachineTriggerAction.ActionSettings.Mode.Custom)
{
EditorGUILayout.HelpBox("Use the Event() list below to call custom methods", MessageType.Info);
Expand All @@ -117,7 +118,7 @@ bool DrawActionSettings(SerializedProperty property, bool expanded)
if (value != null && (value as Behaviour) == null)
EditorGUILayout.HelpBox("Target must be a Behaviour in order to Enable/Disable", MessageType.Warning);
}

#if CINEMACHINE_TIMELINE
bool isPlayStop = isPlay
|| actionProp.intValue == (int)CinemachineTriggerAction.ActionSettings.Mode.Stop;
if (isPlayStop)
Expand All @@ -128,7 +129,7 @@ bool DrawActionSettings(SerializedProperty property, bool expanded)
EditorGUILayout.HelpBox("Target must have a PlayableDirector or Animator in order to Play/Stop", MessageType.Warning);
}
}

#endif
if (!isCustom && targetProp.objectReferenceValue == null)
EditorGUILayout.HelpBox("No action will be taken because target is not valid", MessageType.Info);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public override float GetPropertyHeight(SerializedProperty prop, GUIContent labe
prop.NextVisible(true); // Skip outer foldout
do
{
if (!prop.propertyPath.StartsWith(prefix))
if (!prop.propertyPath.Contains(prefix)) // if it is part of an array, then it won't StartWith prefix
break;
string header = HeaderText(prop);
if (header != null)
Expand Down Expand Up @@ -68,7 +68,7 @@ public override void OnGUI(Rect rect, SerializedProperty prop, GUIContent label)
prop.NextVisible(true); // Skip outer foldout
do
{
if (!prop.propertyPath.StartsWith(prefix))
if (!prop.propertyPath.Contains(prefix)) // if it is part of an array, then it won't StartWith prefix
break;
string header = HeaderText(prop);
if (header != null)
Expand Down
8 changes: 6 additions & 2 deletions Editor/PropertyDrawers/EmbeddedAssetPropertyDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,14 @@ Type EmbeddedAssetType(SerializedProperty property)
Type type = property.serializedObject.targetObject.GetType();
var a = property.propertyPath.Split('.');
for (int i = 0; i < a.Length; ++i)
type = type.GetField(a[i],
{
var field = type.GetField(a[i],
System.Reflection.BindingFlags.Public
| System.Reflection.BindingFlags.NonPublic
| System.Reflection.BindingFlags.Instance).FieldType;
| System.Reflection.BindingFlags.Instance);
if (field == null) continue;
type = field.FieldType;
}
return type;
}

Expand Down
25 changes: 25 additions & 0 deletions Editor/Windows/CinemachineSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,38 @@ internal static Texture2D CinemachineHeader

internal static event Action AdditionalCategories = null;

#if !UNITY_2021_2_OR_NEWER
[InitializeOnLoadMethod]
/// Ensures that CM Brain logo is added to the Main Camera
/// after adding a virtual camera to the project for the first time
static void OnPackageLoadedInEditor()
{
#if UNITY_2020_3_OR_NEWER
// Nothing to load in the context of a secondary process.
if ((int)UnityEditor.MPE.ProcessService.level == 2 /*UnityEditor.MPE.ProcessLevel.Secondary*/)
return;
#endif
if (CinemachineLogoTexture == null)
{
// After adding the CM to a project, we need to wait for one update cycle for the assets to load
EditorApplication.update -= OnPackageLoadedInEditor;
EditorApplication.update += OnPackageLoadedInEditor;
}
else
{
EditorApplication.update -= OnPackageLoadedInEditor;
EditorApplication.hierarchyWindowItemOnGUI += OnHierarchyGUI; // Update hierarchy with CM Brain logo
}
}

static CinemachineSettings()
{
if (CinemachineLogoTexture != null)
{
EditorApplication.hierarchyWindowItemOnGUI += OnHierarchyGUI;
}
}
#endif

class Styles {
//private static readonly GUIContent sCoreShowHiddenObjectsToggle = new GUIContent("Show Hidden Objects", "If checked, Cinemachine hidden objects will be shown in the inspector. This might be necessary to repair broken script mappings when upgrading from a pre-release version");
Expand Down
10 changes: 5 additions & 5 deletions Runtime/Core/AxisState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ public void SetInputAxisProvider(int axis, IInputAxisProvider provider)
public bool HasInputProvider { get => m_InputAxisProvider != null; }

/// <summary>
/// Updates the state of this axis based on the axis defined
/// Updates the state of this axis based on the Input axis defined
/// by AxisState.m_AxisName
/// </summary>
/// <param name="deltaTime">Delta time in seconds</param>
/// <returns>Returns <b>true</b> if this axis' input was non-zero this Update,
/// <returns>Returns <b>true</b> if this axis's input was non-zero this Update,
/// <b>false</b> otherwise</returns>
public bool Update(float deltaTime)
{
Expand All @@ -213,9 +213,9 @@ public bool Update(float deltaTime)
// Cheating: we want the render frame time, not the fixed frame time
if (CinemachineCore.UniformDeltaTimeOverride >= 0)
deltaTime = CinemachineCore.UniformDeltaTimeOverride;
else if (deltaTime >= 0 && m_LastUpdateTime != 0)
deltaTime = Time.time - m_LastUpdateTime;
m_LastUpdateTime = Time.time;
else if (Time.inFixedTimeStep && deltaTime >= 0 && m_LastUpdateTime != 0)
deltaTime = Time.realtimeSinceStartup - m_LastUpdateTime;
m_LastUpdateTime = Time.realtimeSinceStartup;

if (m_InputAxisProvider != null)
m_InputAxisValue = m_InputAxisProvider.GetAxisValue(m_InputAxisIndex);
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Core/CinemachineCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public sealed class CinemachineCore
public static readonly int kStreamingVersion = 20170927;

/// <summary>Human-readable Cinemachine Version</summary>
public static readonly string kVersionString = "2.6.11";
public static readonly string kVersionString = "2.6.12";

/// <summary>
/// Stages in the Cinemachine Component pipeline, used for
Expand Down
4 changes: 4 additions & 0 deletions Runtime/Helpers/CinemachineTriggerAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ public enum Mode
Enable,
/// <summary>Disable a component</summary>
Disable,
#if CINEMACHINE_TIMELINE
/// <summary>Start animation on target</summary>
Play,
/// <summary>Stop animation on target</summary>
Stop
#endif
}

/// <summary>Serializable parameterless game event</summary>
Expand Down Expand Up @@ -169,6 +171,7 @@ CinemachineVirtualCameraBase vcam
targetBehaviour.enabled = false;
break;
}
#if CINEMACHINE_TIMELINE
case Mode.Play:
{
PlayableDirector playable
Expand Down Expand Up @@ -219,6 +222,7 @@ PlayableDirector playable
}
break;
}
#endif
}
}
m_Event.Invoke();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
using UnityEngine;
#if CINEMACHINE_TIMELINE
using UnityEngine;
using UnityEngine.Playables;

namespace Cinemachine.Examples
{

public class GenericTrigger : MonoBehaviour
{
public PlayableDirector timeline;

// Use this for initialization
void Start()
public class GenericTrigger : MonoBehaviour
{
timeline = GetComponent<PlayableDirector>();
}
public PlayableDirector timeline;

// Use this for initialization
void Start()
{
timeline = GetComponent<PlayableDirector>();
}

void OnTriggerExit(Collider c)
{
if (c.gameObject.CompareTag("Player"))
void OnTriggerExit(Collider c)
{
// Jump to the end of the timeline where the blend happens
// This value (in seconds) needs to be adjusted as needed if the timeline is modified
timeline.time = 27;
if (c.gameObject.CompareTag("Player"))
{
// Jump to the end of the timeline where the blend happens
// This value (in seconds) needs to be adjusted as needed if the timeline is modified
timeline.time = 27;
}
}
}

void OnTriggerEnter(Collider c)
{
if (c.gameObject.CompareTag("Player"))
void OnTriggerEnter(Collider c)
{
timeline.Stop(); // Make sure the timeline is stopped before starting it
timeline.Play();
if (c.gameObject.CompareTag("Player"))
{
timeline.Stop(); // Make sure the timeline is stopped before starting it
timeline.Play();
}
}
}
}

}
#endif
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.unity.cinemachine",
"displayName": "Cinemachine",
"version": "2.6.11",
"version": "2.6.12",
"unity": "2018.4",
"description": "Smart camera tools for passionate creators. \n\nIMPORTANT NOTE: If you are upgrading from the Asset Store version of Cinemachine, delete the Cinemachine asset from your project BEFORE installing this version from the Package Manager.",
"keywords": [ "camera", "follow", "rig", "fps", "cinematography", "aim", "orbit", "cutscene", "cinematic", "collision", "freelook", "cinemachine", "compose", "composition", "dolly", "track", "clearshot", "noise", "framing", "handheld", "lens", "impulse" ],
Expand Down