Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 Atviksord · Mar 02, 2014 at 06:21 PM · camerawarnings

MissingComponentException: There is no 'Camera'

MissingComponentException: There is no 'Camera' attached to the "CoinPrefab" game object, but a script is trying to access it. You probably need to add a Camera to the game object "CoinPrefab". Or your script needs to check if the component is attached before using it. UnityEngine.Camera.set_pixelRect (Rect value) (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/UnityEngineCamera.cs:213) PictireInPicture.AdjustCamera () (at Assets/MyScripts/PictireInPicture.cs:82) PictireInPicture.Update () (at Assets/MyScripts/PictireInPicture.cs:32)

The thing is, i dont want a camera on the coinprefab, and none of my code is asking for it. i have NO idea where this error is coming from and why it randomly wants a camera, it keeps SPAMMING this warning while in play mode

 using UnityEngine;
 using System.Collections;
 
 public class PictireInPicture : MonoBehaviour {
 
     public enum HorizontalAlignment{left, center, right};
     public enum VerticalAlignment{top,middle,bottom};
     public HorizontalAlignment horizontalAlignment = HorizontalAlignment.left;
     public VerticalAlignment verticalAlignment = VerticalAlignment.top;
     public enum ScreenDimensions{pixels,screen_percentage};
     public ScreenDimensions dimensionsIn = ScreenDimensions.screen_percentage;
     public int width = 50;
     public int height = 50;
     public float xOffset = 0f;
     public float yOffset = 0f;
     public bool update = true;
     private int hsize, vsize, hloc , vloc;
 
     // Use this for initialization
     void Start () 
     {
         AdjustCamera ();
     
     }
     
     // Update is called once per frame
     void Update ()
     {
     if (update)
         {
 
             AdjustCamera();
         }
     }
 
     void AdjustCamera()
     {
         if (dimensionsIn == ScreenDimensions.screen_percentage)
         {
             hsize = Mathf.RoundToInt(width * 0.01f * Screen.width);
             vsize = Mathf.RoundToInt(height * 0.01f * Screen.height);
 
         }
 
         else  
         {
             hsize = width;
             vsize = height;
         }
         if (horizontalAlignment == HorizontalAlignment.left) 
         {
             hloc = Mathf.RoundToInt(xOffset * 0.01f * Screen.width);
 
         }
         else if (horizontalAlignment == HorizontalAlignment.right) 
         {
 
             hloc = Mathf.RoundToInt(((Screen.width - hsize) - (xOffset * 0.01f * Screen.width)));
         }
         else
         {
             hloc = Mathf.RoundToInt((Screen.width * 0.5f) - (hsize * 0.5f) - (xOffset * 0.01f * Screen.width));             
         }
 
 
         if (verticalAlignment == VerticalAlignment.top) 
         {
             vloc = Mathf.RoundToInt(( Screen.height - vsize) - (yOffset * 0.01f * Screen.height));
         }
         else if (verticalAlignment == VerticalAlignment.bottom) 
         {
             vloc = Mathf.RoundToInt(( yOffset * 0.01f * Screen.height));
         }
 
         else 
         {
 
             vloc = Mathf.RoundToInt(((Screen.height * 0.5f) - (vsize * 0.5f)) - (yOffset * 0.01f * Screen.height));
                 
         }
 
         camera.pixelRect = new Rect (hloc, vloc, hsize, vsize);
     }
 
 }


this is my minimap code, the problem seems to lie within

Comment
Add comment · Show 4
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 robertbu · Mar 02, 2014 at 06:22 PM 1
Share

What about line 82.

avatar image Atviksord · Mar 02, 2014 at 07:22 PM 0
Share

Line 82 is fine, its a code for a $$anonymous$$imap. it should work regardless if i have this prefab or not. NO idea why it wants a camera on it though

avatar image PsychoHead · Mar 02, 2014 at 07:41 PM 1
Share

It is in fact line 82, as that references a camera component, which in your case does not seem to be attached.

avatar image Atviksord · Mar 02, 2014 at 08:13 PM 0
Share

it's referencing a campera component yes, it's my mapcamera that it's attached to, so that does not seem to be the case?

http://puu.sh/7gtIu.png

0 Replies

· Add your reply
  • Sort: 

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.

Follow this Question

Answers Answers and Comments

21 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

Related Questions

GameObject invisible at certain camera angles 0 Answers

OnBecameInvisible only running when game stops 2 Answers

First person view question 1 Answer

Camera Problem 0 Answers

How can I check if an object is seen by my camera and if i't inside a gui? 1 Answer


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