- Home /
targeting desnsity inside buoyancy script
Hi all,
I'm using the awesome Buoyancy script from this thread.
http://forum.unity3d.com/threads/72974-Buoyancy-script.
What I'm trying to do is target the density value of the script so I can adjust it on the fly via a slider in the camera view. So when in game I can make my ship float or sink.
Unfortunately for the life of me I cant seem to target it.
I've attached it to a cube, and created a separate gui script to attempt to adjust the value.
function OnGUI () {
var hSliderValue : float = 0.0; GUI.Label (Rect (155, 5, 125, 30), "Density");
Buoyancy.Density = GUI.HorizontalSlider (Rect(125,25,100,30), Buoyancy.Density, 500, 1000); }
I'm trying to adjust this value in the Buoyancy.cs files
public class Buoyancy : MonoBehaviour { // public Ocean ocean;
public float density = 500;
public int slicesPerAxis = 2;
public bool isConcave = false;
public int voxelsLimit = 16;
Im still getting my head around all this, and would love some help if possible please.
Sorry if im being stupid, but still learning :)
Your answer
Follow this Question
Related Questions
Error: you are pushing more GUIClips than you are poping. 1 Answer
How to create a gui that the user can write in and save? 2 Answers
Bool script error 1 Answer
Unity freezes when changing GUI.Color.a 1 Answer
Re Enable C# script on camera 1 Answer