Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

New Cinemachine v1.5

Discussion in 'Cinemachine' started by Adam_Myhill, Mar 5, 2017.

  1. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,733
    You don't need to hack the Brain code for this. Using the CinemachineExtension API, it's very simple to add an extension to the vcam that post-processes the position prior to it being passed to the Camera.
     
  2. treecki

    treecki

    Joined:
    Feb 6, 2017
    Posts:
    7
    Ahh ok that's great to hear! I definitely feel janky hacking into the brain code. How exactly would I go about doing this with the CinemachineExtension API then? Would I make a new script that grabs the cinemachine brain and tells it's position? Because I want the z order change to apply for all vcams, not just a follow cam for the character. Also is this z order formula the best method for top down z order 2d cameras?
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,733
    Here is a simple script that uses the CinemachineExtension API to lock the camera Z. Add it as an extension to each of your virtual cameras (it will show up in the "extensions" menu at the bottom of the vcam inspector. From script, just add it as a component).
    Code (CSharp):
    1. using UnityEngine;
    2. using Cinemachine;
    3.  
    4. /// <summary>
    5. /// An add-on module for Cinemachine Virtual Camera that locks the camera's Z co-ordinate
    6. /// </summary>
    7. [ExecuteInEditMode] [SaveDuringPlay] [AddComponentMenu("")] // Hide in menu
    8. public class LockCameraZ : CinemachineExtension
    9. {
    10.     [Tooltip("Lock the camera's Z position to this value")]
    11.     public float m_ZPosition = 10;
    12.  
    13.     protected override void PostPipelineStageCallback(
    14.         CinemachineVirtualCameraBase vcam,
    15.         CinemachineCore.Stage stage, ref CameraState state, float deltaTime)
    16.     {
    17.         if (stage == CinemachineCore.Stage.Body)
    18.         {
    19.             var pos = state.RawPosition;
    20.             pos.z = m_ZPosition;
    21.             state.RawPosition = pos;
    22.         }
    23.     }
    24. }
    Sorry but I don't really understand this question. It's not clear to me exactly what you're trying to do.
     
    Alverik likes this.
  4. XN4k3dBR

    XN4k3dBR

    Joined:
    Sep 15, 2015
    Posts:
    11
    I have version 2.110, but dont work xbox one !
    I managed to compile for xbox one but the scenes created by the cinemachine 2.110 do not work!

    why?
     
    Last edited: Jun 1, 2018
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,733
    Can you be a little more specific?
     
  6. XN4k3dBR

    XN4k3dBR

    Joined:
    Sep 15, 2015
    Posts:
    11
    The cutscene works in unity normally, but when I send to xbox one it does not work.
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,733
    "Does not work" isn't specific enough.
     
  8. XN4k3dBR

    XN4k3dBR

    Joined:
    Sep 15, 2015
    Posts:
    11
    Okay. I have an intro cutscene. In unity it works perfectly, but when I send to xbox one the cutscene gets stopped, do not run.
    it doesnt even start running, stays in he first frame
     
    Last edited: Jun 1, 2018
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,733
    Why do you think this is a Cinemachine problem?
     
  10. XN4k3dBR

    XN4k3dBR

    Joined:
    Sep 15, 2015
    Posts:
    11
    because he game was running ok before i put that cutscene on
     
  11. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,733
    ok, but maybe it's a timeline thing, not a Cinemachine thing. You say the timeline stays on Frame 1. You might try asking on the TImeline forum. Try simplifying your cutscene to search for the culprit.
     
  12. XN4k3dBR

    XN4k3dBR

    Joined:
    Sep 15, 2015
    Posts:
    11
    I solved the problem. Updated Unity's version and it worked
    thx for supporting
     
  13. ramJat

    ramJat

    Joined:
    Jun 12, 2018
    Posts:
    12
    Hello,
    i am getting some errors when i try to make build for Holocene(UWP).

    C:\Users\RChoudharyX098698\AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.postprocessing@2.0.3-preview\PostProcessing\Runtime\PostProcessManager.cs(77,41): error CS1061: 'Type' does not contain a definition for 'IsAbstract' and no extension method 'IsAbstract' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)

    C:\Users\RChoudharyX098698\AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.postprocessing@2.0.3-preview\PostProcessing\Runtime\PostProcessManager.cs(76,40): error CS1061: 'Type' does not contain a definition for 'IsDefined' and no extension method 'IsDefined' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)

    C:\Users\RChoudharyX098698\AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.postprocessing@2.0.3-preview\PostProcessing\Runtime\PostProcessManager.cs(75,40): error CS1061: 'Type' does not contain a definition for 'IsSubclassOf' and no extension method 'IsSubclassOf' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)

    i am try to make build for UWP using unity version 2018.1.1 with LightWeight pipeline
     
  14. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,733
    PostProcessing v2 isn't compatible with UWP/Mono due to the fact that it's a very limited runtime that doesn't even support the base .Net API, it only works with UWP/IL2CPP
     
  15. ramJat

    ramJat

    Joined:
    Jun 12, 2018
    Posts:
    12
    Does it solved in new unity version 2018.2
     
  16. ramJat

    ramJat

    Joined:
    Jun 12, 2018
    Posts:
    12
    Whenever i import holotoolkit in project it shows this error
    System.Exception: Package directory not found: "C:\Users\RChoudharyX098698\.nuget\packages\Microsoft.CSharp\4.0.1".
    at UnityEditor.Scripting.Compilers.NuGetPackageResolver.Resolve () [0x000dd] .

    Why, any suggestions
     
  17. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,733
    We generally recommend users to move to UWP/IL2CPP as it's better in every way.
     
  18. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,733
    Try positing this question on another thread, maybe the package manager one
     
  19. ramJat

    ramJat

    Joined:
    Jun 12, 2018
    Posts:
    12
    But After selecting IL2CPP another error coming.
    Unsafe code may only appear if compiling with /unsafe. Enable "Allow 'unsafe' code" in the inspector for 'Packages/com.unity.render-pipelines.core/CoreRP/com.unity.render-pipelines.core.Runtime.asmdef' to fix this error.
    i am already allow 'unsafe' code active but still facing this issue.
    please help me i am facing this issue since long time.
    thanks
     
  20. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,733
    I can't really help you on that one. Try asking the question here: https://forum.unity.com/forums/editor-general-support.10/
     
  21. ramJat

    ramJat

    Joined:
    Jun 12, 2018
    Posts:
    12
  22. mr0ng

    mr0ng

    Joined:
    Jun 22, 2017
    Posts:
    2
    @Gregoryl Can you elaborate on why UWP/IL2CPP is better in every way? I'm struggling to understand the benefits, as I am used to the ability to still edit my C# code after building out of Unity. I'd love to learn more about the benefits of IL2CPP so I can feel better about the .NET backend being depreciated.
     
  23. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,733
    Mostly it's to enable a single simplified code-base for serialization. It's just easier to support and less bug-prone.