detzt / BugReporting

Used to file Unity bug reports
MIT License
0 stars 0 forks source link

Cannot implement ICinemachineTargetGroup using TargetPositionCache and respecting the UseScrubbingCache setting #14

Closed detzt closed 1 week ago

detzt commented 2 months ago

Bug report sent.

What happened

I am implementing a custom TargetGroup that implements the ICinemachineTargetGroup interface. It is mostly the same as the CinemachineTargetGroup class, but has Vector3 weights instead of float weights. I could implement everything in the same way as CinemachineTargetGroup does until TargetPositionCache is used, since that class is only internal. Copying the TargetPositionCache class as well got it to compile, but the CinemachineTimelinePrefs that controls whether the cache is active or not is also internal and thereby not accessible.

Ignoring the CinemachineTimelinePrefs ScrubbingCache setting is an option, but I would prefer to support it.

How can we reproduce it using the example you attached

  1. Open Scripts/TargetPositionCache.cs and uncomment line 11 (comment line 10 instead).
  2. Notice the "CinemachineTimelinePrefs is inaccessible due to its protection level" error.
  3. Delete the Scripts/TargetPositionCache.cs file.
  4. Notice the "TargetPositionCache is inaccessible due to its protection level" errors.

This can be fixed by making com.unity.cinemachine/Runtime/Core/TargetPositionCache public.

detzt commented 1 week ago

Fixed in Cinemachine 3.1.2