- Home /
The question is answered, right answer was accepted
error CS1031: Type expected fix
//this is my ChangeCameraMoreSimple.cs script // CharacterController.js is another script, I tried adding the script, CharacterController, but got this problem
using UnityEngine; using System.Collections;
public class ChangeCameraMoreSimple : MonoBehaviour
public class CharacterController : MonoBehaviour
{
public GameObject carCamera;
public GameObject playerCamera;
public GameObject Car;
public GameObject Player;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.E))
{
carCamera.active = true;
playerCamera.active = false;
Player.active = false;
Car.active = true;
}
if (Input.GetKey(KeyCode.R))
{
playerCamera.active = true;
carCamera.active = false;
Player.active = true;
Car.active = true;
GetComponent(CharacterController).enabled = true;
}
}
}
is this your camera script or your charactercontroller script? If you are in your camera script getcomponent is ok
public class ChangeCamera$$anonymous$$oreSimple : $$anonymous$$onoBehaviour public class CharacterController : $$anonymous$$onoBehaviour? You cant do this.
how do i add a script to this script, as i have a line which is " GetComponent(CharacterController).enabled = true;" this calls for a "CharacterController" script, wouldn't I need to find the script called "CharacterController"?
Answer by Julien-Lynge · May 08, 2013 at 09:02 PM
Your post (as it appears now) clearly isn't something we can give you one answer for - there are numerous problems with your script, and it's obvious that you're in a bit over your head. It sounds like what you're looking for is Unity training, rather than a specific answer. I would suggest visiting the following training websites to find the one that best helps you move forward. In addition to the sites below, you can always search YouTube, which has a large number of user-created Unity tutorials.
3DBuzz (hover over the Unity dropdown) - http://www.3dbuzz.com/vbforum/sv_home.php
Lynda - https://www.lynda.com/
BurgZergArcade - http://www.burgzergarcade.com/
Unity3DStudent - http://www.unity3dstudent.com/
UnityGems - http://unitygems.com/
CGCookie - http://cgcookie.com/unity/
@S$$anonymous$$ASapps,
This isn't spam, these are a list of resources to help you solve your problem. I am closing your question - Unity Answers does not exist to bugfix your code for you - that is up to you to do if you want to be a game developer. We are happy to help you learn Unity, which is what I'm attempting to do here. Good luck!
it is spam as it's something people say to make people thing 'i'm s***'
Please don't be disrespectful to people that are trying to help you.
You are not 'entitled' to our time - when we try to help you, we do it for free, out of the goodness of our hearts. If you don't think an answer is helpful, don't disrespect the person giving it. Just tell us that you don't think it's helpful, and explain why.
your the disrespectful one. because your saying i'm stupid and then you act the victim