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 DarkerColt · Jul 29, 2012 at 02:30 AM · errorparsingneed

Parsing Error:

I just started creating an online unity game, but i only started using unity a week ago. So i am unsure of how to fix this parsing error Number 1:(2,10), Number 2:(2,32)

function OnNetworkInstantiate1 (msg : NetworkMessageInfo) {

var Camera1 =camera;

if(networkView.isMine == true) { camera.enabled = true; Camera1.enabled = true; } else

{ Camera1.enabled = false; camera.enabled = false; }

}

if anybody could help it would be much appreciated!

Comment
Add comment · Show 2
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 Seth-Bergman · Jul 29, 2012 at 03:17 AM 0
Share

don't know much about networking, but is camera defined somewhere in your script?

at any rate, if Camera1 = camera, then you set them both to reference the same object, so saying

camera.enabled = true;

Camera1.enabled = true;

is repetitive

avatar image OperationDogBird · Jul 29, 2012 at 05:21 AM 0
Share

it looks like you reference the same camera twice..so theres no need to turn both on or both off, or even store the camera in a variable. Just say camera.enabled=true; and camera.enabled=false; respectively.

What is line 2 of this script?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Seth-Bergman · Jul 29, 2012 at 05:41 AM

I think camera is not defined. Try:

 function OnNetworkInstantiate1 (msg : NetworkMessageInfo) {
 if(networkView.isMine) 
 Camera.main.enabled = true;  
 else
 Camera.main.enabled = false; 
 }

but I'm not really sure what you're trying to do though

EDIT: nevermind try

function OnNetworkInstantiate (msg : NetworkMessageInfo) {

lose the 1

if this IS attached to the camera, you can replace Camera.main.enabled with camera.enabled and the above is still good (and now that I think about it, that must be what you want, to enable the camera on OUR player, so use camera.enabled)

 function OnNetworkInstantiate (msg : NetworkMessageInfo) {
 if(networkView.isMine) 
 camera.enabled = true;  
 else
 camera.enabled = false; 
 }
Comment
Add comment · Show 4 · 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 OperationDogBird · Jul 29, 2012 at 05:48 AM 0
Share

my guess is he is using the default call to camera if this script is attached to a Camera.

//On A Camera

 camera.enabled=false;

Just tested and it works.

I havent done a network project, but my guess is its the same deal. $$anonymous$$y guess is the parse error comes from a different line because if the camera is not defined you get

There is no 'Camera' attached to the "GameObject" game object, but a script is trying to access it.

avatar image Seth-Bergman · Jul 29, 2012 at 05:53 AM 0
Share

or this script isn't attached to the camera..

hence my suggestion

but I guess if those are the lines of the error

(2,10),(2,32)

then that really wouldn't add up

more likely it's the first line

function OnNetworkInstantiate1 (msg : Network$$anonymous$$essageInfo) {

I guess...

avatar image Seth-Bergman · Jul 29, 2012 at 05:57 AM 0
Share

yup it's OnNetworkInstantiate, no 1, that's the prob probably

avatar image OperationDogBird · Jul 29, 2012 at 06:01 AM 0
Share

lol yep that would cause the problem! kinda overlooked that 1...

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

7 People are following this question.

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

Related Questions

Multiple Cars not working 1 Answer

How do I fix this really wierd parsing error? 0 Answers

Getting errors on my chart script 1 Answer

Parsing error and unexpected symbol `}' (25,41) 1 Answer

Compiler error?? 2 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