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 /
This question was closed Dec 27, 2012 at 06:12 PM by ExTheSea for the following reason:

Prolem comes from another Problem with corrupte files

avatar image
0
Question by ExTheSea · Nov 23, 2012 at 06:41 PM · nullreferenceexceptiongetcomponentmouselookunity 4

GetComponent NullReferenceException

Hey,

When I build my project and try to connect to or start a server the camera of the player flickers. The player camera jumps from looking straight upward to looking straight forward the entire time which causes it to flicker. When I ran the project in the Editor and connect to or start a server it's totally fine expect that if another player is on the server I get a NullReferenceException in this part of my code:

 function OnNetworkInstantiate(){
 
 if(!networkView.isMine){
     var tmp5 = transform.gameObject.GetComponent(MouseLook);//<--Error
     tmp5.enabled = false;
 }
 }

This is not the whole script(It's called PlayerScript) I just filtered out the interesting part. I hope it's enough code.

In the MouseLook script I also have this code:

 void Start(){
   if(!networkView.isMine)
     enabled = false;
 
   if (rigidbody)
     rigidbody.freezeRotation = true;
 }

I also noticed similar problems with GetComponent in other Projects after updating to Unity 4.

I found it weird that these problems started with the Update and I hope someone can help me.

Cheers,

ExTheSea

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

1 Reply

  • Sort: 
avatar image
0

Answer by DeveshPandey · Nov 26, 2012 at 06:10 AM

Use Generic function. See here

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 ExTheSea · Nov 26, 2012 at 03:19 PM 0
Share

Thank you for your answer. I will try this as soon as I get my Unity to work again. ($$anonymous$$y builds don't work because Unity produces corrupt sharedassets1.assets files).

I will come back to this if I get to try it.

Follow this Question

Answers Answers and Comments

11 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

Related Questions

NullReferenceException....Again(sorry) 0 Answers

NullReference Problem with pragma strict 1 Answer

NullReferenceException when using GetComponent to access script variables 1 Answer

NullReferenceException when trying to access other GO in script. C# 1 Answer

script GetComponent, nullReference error 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