- Home /
inaccessible due to protection level, but it's public
the error is: ballmovement.balldirection is inaccessible due to its protection level the member ballmovement.balldirection cannot be used as method or delegate
and here the code:
using UnityEngine;
using System.Collections;
public class ballmovement : MonoBehaviour {
public Vector3 balldirection = new Vector3(0, 0, 0);
public float randomX = Random.Range (0.2F, 1F);
public float randomY = Random.Range (0.2F, 1F);
// Use this for initialization
void Start () {
balldirection = balldirection (randomX, randomY, 0);
}
// Update is called once per frame
void Update () {
transform.Translate (balldirection);
}
}
Answer by mattyman174 · Jun 12, 2014 at 01:58 AM
balldirection = balldirection (randomX, randomY, 0);
This line makes no sense. Are you trying to assign the vector values (randomX, randomY, 0) to balldirection?
If so:
balldirection = balldirection + new Vector3(randomX, randomY, 0);
In future, can you not paraphrase Errors, please post the Error as it appears in the Editor in its entirety.
oh, thanks. Solved that way : ) uhm the error is as it appears, i just rewrote it by hand ins$$anonymous$$d of copying it...
Your answer
![](https://koobas.hobune.stream/wayback/20220613151334im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Passing Parameters by Value or by Reference 2 Answers
ArgumentException: The Object you want to instantiate is null. 1 Answer
Storing a method in a variable 2 Answers
Need help for my Arkanoid-like game. i got problem to make my ball reflects on the wall 1 Answer
Variable Not Changing In Method 1 Answer