TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Victor S. Muniz
NA
2
6.2k
The modifier ‘private’ is not valid for this item
May 27 2020 6:31 PM
I'm having a problem and i don't know how to resolve it. The error is on the line 42 of the code:
using
UnityEngine;
using
System.Collections;
public
class
Bullet : MonoBehaviour
{
[Header(
"BulletConfig"
)]
public
int
range;
public
int
damage;
public
float
mass;
public
float
speed;
[Header(
"Imports"
)]
public
PlayerController Player;
public
ParticleSystem impact;
//Privates
private
Rigidbody rb;
private
Vector3 origin;
void
Start()
{
rb = GetComponents
();
origin = transform.position;
}
void
Update()
{
//Massa
rb.mass = mass;
//Frente
Vector3 horizontal = transform.right * 0;
Vector3 vertical = transform.forward * 1;
Vector3 velocity = (horizontal + vertical).normalized * speed;
rb.MovePosition(rb.position + velocity * Time.fixedDeltaTime);
//Range
if
(Vector3.Distance(origin, transform.position) > range)
{
Destroy(GameObject);
}
private
void
OnCollisionEnter(Collision collision)
{
Destroy(gameObject);
if
(collision.gameObject.tag ==
"Terrain"
)
{
GameObject eff = Instantiate(impact, collision.transform.position, Quaternion.Identity).gameObject;
eff.transform.position +=
new
Vector3(0, 0.1f, 0);
eff.transform.eulerAngles =
new
Vector3(-90, 0, 0);
}
}
}
}
Reply
Answers (
2
)
modify a field of ten that I have in the table with entity f
How to use UI Framework in Winforms C#?