Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9292755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:57:26+00:00 2026-06-18T20:57:26+00:00

My script is attached to a character controller. And i declared, public Camera camera;

  • 0

My script is attached to a character controller.

And i declared,

public Camera camera;

in class. In update function i given,

if(Input.GetMouseButtonDown(0)){ 
Ray ray = camera.ScreenPointToRay(Input.mousePosition); 
if (Physics.Raycast (ray, out hit3, 400.0F)){
    print(hit3.collider.gameObject.name); 
}
}

But i am getting error

"UnassignedReferenceException: 
The variable camera of 'characterScript' has not been assigned.
You probably need to assign the camera variable of the 
characterScript script in the inspector."

Help me with a good solution.

Thanks in Advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T20:57:27+00:00Added an answer on June 18, 2026 at 8:57 pm

    You didnt initialize your camera. you have to set it through the UI of unity3D. Just drag and drop the camera to the public parametr.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a PHP class/script (opensource/free) that allows me to send emails with attached
What script, class or function you use to send many emails, excluding the in-built
I found this script attached to a modified index page. This looks like some
I have a php pipe script that receives an email, takes an attached *.csv
aspx script: <script type=text/javascript> $(document).ready(function() { $(.div_soru).hide(); $(.div_soru).first().show(); $(.onceki).click(function() { if ($(this).closest(.div_soru).prev(.div_soru).html() != null)
I wrote a small shell script configuring attached external displays with xrandr. # cat
In the attached example script, why won't the MyDialog instance show properly when I
In the attached flex code, I am trying to call a javascript function in
I have a simple login form like below, with an attached jQuery script. I'm
I found this script attached to a thread in the fontforge-users mailing list .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.