• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by uuiarkmedvr · Oct 17, 2018 at 11:41 AM · rigcamerasmanager

How to make a "Camera Rig Manager" that turns off the other 5 cameras not in use?

Hello I am new to Unity and scripting and need some guidance.


I am currently trying to make a guided tour that allows to see how visual impaired sees the world. It is actually impossible right now with this technology to simulate. But im am making the tour for a architect class and they will experience it through Oculus Go. Already made something and made it work. But I want to change how you navigate inside the spheres. And I see now that it would be nice with some more C# knowledge.


I using the Unity Documentation to make this, but get this error.


Assets/Scripts/SetActiveCameraRigA.cs(76,39): error CS1061: Type UnityEngine.GameObject' does not contain a definition for enabled' and no extension method enabled' of type UnityEngine.GameObject' could be found. Are you missing an assembly reference?


And i made a Google Doc to show with pictures and code.


Can anyone help me? I would be so happy for any pointers from anyone!


 using UnityEngine;
 using System.Collections;
  
 public class SetActiveCameraRig : MonoBehaviour
 {
     public GameObject CameraRigA_Normal;
     public GameObject CameraRigB_Cataract;
     public GameObject CameraRigC_Glaucoma;
     public GameObject CameraRigD_RetinitisPigmentosa;
     public GameObject CameraRigE_DiabeticRetinopathy;
     public GameObject CameraRigF_MaculaDegeneration;
  
     //
     public void NormalVision()
     {
         CameraRigA_Normal.enabled = true;
         CameraRigB_Cataract.enabled = false;
         CameraRigC_Glaucoma.enabled = false;
         CameraRigD_RetinitisPigmentosa.enabled = false;
         CameraRigE_DiabeticRetinopathy.enabled = false;
         CameraRigF_MaculaDegeneration.enabled = false;
     }
  
     //
     public void Cataract()
     {
         CameraRigA_Normal.enabled = false;
         CameraRigB_Cataract.enabled = true;
         CameraRigC_Glaucoma.enabled = false;
         CameraRigD_RetinitisPigmentosa.enabled = false;
         CameraRigE_DiabeticRetinopathy.enabled = false;
         CameraRigF_MaculaDegeneration.enabled = false;
     }
  
     //
     public void Glaucoma()
     {
         CameraRigA_Normal.enabled = false;
         CameraRigB_Cataract.enabled = false;
         CameraRigC_Glaucoma.enabled = true;
         CameraRigD_RetinitisPigmentosa.enabled = false;
         CameraRigE_DiabeticRetinopathy.enabled = false;
         CameraRigF_MaculaDegeneration.enabled = false;
     }
  
     //
     public void RetinitisPigmentosa()
     {
         CameraRigA_Normal.enabled = false;
         CameraRigB_Cataract.enabled = false;
         CameraRigC_Glaucoma.enabled = false;
         CameraRigD_RetinitisPigmentosa.enabled = true;
         CameraRigE_DiabeticRetinopathy.enabled = false;
         CameraRigF_MaculaDegeneration.enabled = false;
     }
  
     //
     public void DiabeticRetinopathy()
     {
         CameraRigA_Normal.enabled = false;
         CameraRigB_Cataract.enabled = false;
         CameraRigC_Glaucoma.enabled = false;
         CameraRigD_RetinitisPigmentosa.enabled = false;
         CameraRigE_DiabeticRetinopathy.enabled = true;
         CameraRigF_MaculaDegeneration.enabled = false;
     }
  
     //
     public void MaculaDegeneration()
     {
         CameraRigA_Normal.enabled = false;
         CameraRigB_Cataract.enabled = false;
         CameraRigC_Glaucoma.enabled = false;
         CameraRigD_RetinitisPigmentosa.enabled = false;
         CameraRigE_DiabeticRetinopathy.enabled = false;
         CameraRigF_MaculaDegeneration.enabled = true;
     }
 }











Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by axcersory · Oct 17, 2018 at 12:37 PM

change .enabled to SetActive(false) / SetActive(true)

example : CameraRigF_MaculaDegeneration.SetActive(false);

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by uuiarkmedvr · Oct 17, 2018 at 04:00 PM

Did some changes but still stuck. No Errors and Warnings this time.

Now the problem is to actually manage to switch between the different CameraRig's.


 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class SetActiveCameraRig : MonoBehaviour
 {
     public GameObject CameraRigA_Normal;
     public GameObject CameraRigB_Cataract;
     public GameObject CameraRigC_Glaucoma;
     public GameObject CameraRigD_RetinitisPigmentosa;
     public GameObject CameraRigE_DiabeticRetinopathy;
     public GameObject CameraRigF_MaculaDegeneration;
 
     // Update is called once per frame
     public void Update()
     {
         if (CameraRigA_Normal == true)
         {
             CameraRigB_Cataract.SetActive(false);
             CameraRigC_Glaucoma.SetActive(false);
             CameraRigD_RetinitisPigmentosa.SetActive(false);
             CameraRigE_DiabeticRetinopathy.SetActive(false);
             CameraRigF_MaculaDegeneration.SetActive(false);
         }
 
         else if (CameraRigB_Cataract == true)
         {
             CameraRigA_Normal.SetActive(false);
             CameraRigC_Glaucoma.SetActive(false);
             CameraRigD_RetinitisPigmentosa.SetActive(false);
             CameraRigE_DiabeticRetinopathy.SetActive(false);
             CameraRigF_MaculaDegeneration.SetActive(false);
         }
         else if (CameraRigC_Glaucoma == true)
         {
             CameraRigA_Normal.SetActive(false);
             CameraRigB_Cataract.SetActive(false);
             CameraRigD_RetinitisPigmentosa.SetActive(false);
             CameraRigE_DiabeticRetinopathy.SetActive(false);
             CameraRigF_MaculaDegeneration.SetActive(false);
         }
         else if (CameraRigD_RetinitisPigmentosa == true)
         {
             CameraRigA_Normal.SetActive(false);
             CameraRigB_Cataract.SetActive(false);
             CameraRigC_Glaucoma.SetActive(false);
             CameraRigE_DiabeticRetinopathy.SetActive(false);
             CameraRigF_MaculaDegeneration.SetActive(false);
         }
         else if (CameraRigE_DiabeticRetinopathy == true)
         {
             CameraRigA_Normal.SetActive(false);
             CameraRigB_Cataract.SetActive(false);
             CameraRigC_Glaucoma.SetActive(false);
             CameraRigD_RetinitisPigmentosa.SetActive(false);
             CameraRigF_MaculaDegeneration.SetActive(false);
         }
         else if (CameraRigF_MaculaDegeneration == true)
         {
             CameraRigA_Normal.SetActive(false);
             CameraRigB_Cataract.SetActive(false);
             CameraRigC_Glaucoma.SetActive(false);
             CameraRigD_RetinitisPigmentosa.SetActive(false);
             CameraRigE_DiabeticRetinopathy.SetActive(false);
         }
     }
 }





Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image axcersory · Oct 17, 2018 at 06:07 PM 0
Share

@uuiarkmedvr $$anonymous$$aybe you can use an Input to switch between camera. Actually i dont know what are you going to do. And sorry for my bad english.

Example: If you press a key then switch the camera.

 public void Update()
 {
              if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.Y))
              {
                  CameraRigA_Normal.SetActive(true); // $$anonymous$$ake this true and else false.
                  CameraRigB_Cataract.SetActive(false);
                  CameraRigC_Glaucoma.SetActive(false);
                  CameraRigD_RetinitisPigmentosa.SetActive(false);
                  CameraRigE_DiabeticRetinopathy.SetActive(false);
                  CameraRigF_$$anonymous$$aculaDegeneration.SetActive(false);
              }
      
              if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.U))
              {
                  CameraRigB_Cataract.SetActive(true);//make this true and else false.
                  CameraRigA_Normal.SetActive(false);
                  CameraRigC_Glaucoma.SetActive(false);
                  CameraRigD_RetinitisPigmentosa.SetActive(false);
                  CameraRigE_DiabeticRetinopathy.SetActive(false);
                  CameraRigF_$$anonymous$$aculaDegeneration.SetActive(false);
              }
 }

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

91 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Import Cinemachine Plugin to an offline project 0 Answers

how can i moving from camera to other using a code? 1 Answer

Switch Cameras when Player is visible? 1 Answer

Respawn Player / enable new camera 0 Answers

Camera Switching or Scene Changes? 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges