Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta 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. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    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

Can't access Cinemachine via c#

Discussion in 'Cinemachine' started by GonzoGan, Apr 7, 2018.

  1. GonzoGan

    GonzoGan

    Joined:
    Mar 15, 2013
    Posts:
    36
    Hello,
    as per title, i am trying to access the cinemachine virtual camera script parameters via a custom c#.

    There is no mention on how to do that on cinemachine documentation.

    Any idea?

    Thanks!
     
  2. GonzoGan

    GonzoGan

    Joined:
    Mar 15, 2013
    Posts:
    36
    Edit:

    I figured it out.

    - add
    using.Cinemachine
    on top of the script.
    - refer to the cinemachine camera using
    public CinemachineVirtualCamera vcam
    ;

    you can now access all the parameters:
    upload_2018-4-8_0-8-9.png

    Remember the cinemachine virtual camera might update on a different Update method ("Smart", fixed, late), so make sure to add all your per-frame calculations in the right one, or you won't get the behaviour you expect. (you can check and specify the update method used by the virtual camera clicking on the virtual camera gameobject).

    Hope this will help.
     

    Attached Files:

  3. Adam_Myhill

    Adam_Myhill

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    312
  4. GonzoGan

    GonzoGan

    Joined:
    Mar 15, 2013
    Posts:
    36
  5. Chregu

    Chregu

    Joined:
    Jan 7, 2018
    Posts:
    1
    Hi everyone
    I have a problem that visual studio won't find the Cinemachine Namespace (CS0246) eventhough I installed cinemachine into my project... it once worked but now it won't find the namespace anymore.
    Funnily enough on the unity side of things everything works normally, meaning that if i ignore the errors it works correctly in unity.

    Any ideas why this is happening?
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,636
    Try updating your Visual Studio Tools for Unity
     
  7. VergilUa

    VergilUa

    Joined:
    Dec 22, 2014
    Posts:
    757
    I've encountered same issue, but for Jetbrains Rider. Is there something that can be done?
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,636
    Can you log a bug report with a repro project? It would be much easier to track down that way. Right now it's a little vague.
     
  9. VergilUa

    VergilUa

    Joined:
    Dec 22, 2014
    Posts:
    757
    There's not much really to repro. I'm using Unity 2018.1.7f1 for that project. I've simply installed the Cinemachine via the package manager.

    It works as intended in Unity (there's no errors), but ReSharper in Rider doesn't pick anything from the Cinemachine package, stating that it is not found, highlighting everything related as errors.

    Tried restarting both IDE's, no luck, so I've reverted to Asset Store version.

    Which works just fine. Also, I've installed Text Mesh Pro via Package Manager, and it is picked by the Rider as well.

    Edit: Just realized that I've hijacked the thread, since OP was asking about completely different question. My original post was related to this one:
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,636
    ok, but the folks in charge of solution generation (not me) would like a bug report, so that the issue gets tracked and addressed efficiently. The likelihood of the bug getting fixed tends to be directly proportional to the specificity of the report and the reliability of the repro steps.
    Just saying :)
     
    VergilUa likes this.