- Home /
ASAP HELPUnity Engine Physics is required access non static member!!!
Ok, so i have a ball game where you roll a marble around obstacles. I made it 1 year ago. I went back to it recently and i get the 'An instance of type UnityEngine.PhysicsMaterial is required to access non static member bounciness. Line 101. At First it started like this:
collider.material.bouncyness = 0.5;
I got the error listing many different scripts saying that UnityEngine.PhysicMaterial.bouncyness is obsolete. Use PhysicMaterial.bounciness instead.
So I changed it into:
PhysicMaterial.bounciness = 0.5;
That took away all the errors on the other scrip but on the debugging console it only shows that script with the 'An instance' error!It was working fine a year ago! Is it an update? What did i do wrong?
Answer by syclamoth · May 19, 2012 at 07:37 AM
The suggested correction wasn't telling you to use it as a static member, it was just telling you what the correct name was! Just do this:
collider.material.bounciness = 0.5;
You still need an instance reference- PhysicMaterial.bounciness is the name of the variable in the class, but it can't predict what your specific object will be called.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Targetting error please help 0 Answers
Failed to load Unity.dll 4 Answers
please help NullReferenceException object 1 Answer
Assets/cubeAI.js(2,11): UCE0001: ';' expected. Insert a semicolon at the end. 1 Answer