Pre-Note: I don’t know if the user who created this tutorial has a account here, but maybe if someone knows that they do they could tag them.
I am currently working on converting a script written in C# into visual scripting using Bolt. The tutorial I am following can be found here for reference:
I am currently on part 3 and I’ve run into a snag with following the code. The following line is written as a variable, however the GameObject that is referenced was never mentioned as being created or what sort of object it needs to be created as.
//Drags
public GameObject underWaterObj;
The only time it’s reference (that I can find) in the code is under “Start” seen here:
void Start()
{
[INDENT]//Get the boat's rigidbody
boatRB = gameObject.GetComponent<Rigidbody>();
//Init the script that will modify the boat mesh
modifyBoatMesh = new ModifyBoatMesh(gameObject);
//Meshes that are below and above the water
underWaterMesh = [B]underWaterObj[/B].GetComponent<MeshFilter>().mesh;[/INDENT]
}
Can anyone who either knows what’s going on here or who has successfully finished the tutorial help me understand what underWaterObj is or what type of GameObject I’d need to create to call it in my Bolt Graph?
Thank you ahead of time and I hope you all are staying safe and healthy in these trying times.
Based on the very limited amount of code you shared it can be any GameObject that has a MeshFilter component. Any of the Unity primitives will satisfy that. However without more context I don’t know what the purpose of that object is or what other characteristics it needs to be suitable for that purpose.
You will also need to drag that object from the scene hierarchy into the slot in your inspector for this script to hook it up properly.
Please check the links I posted to help with the context. At least, I hope they are showing on your end. I don’t know if Unity Forums blocks links to less familiar domains and site. If so, then crap. D:
What you name a GameObject in the hierarchy is irrelevant unless you are trying to find it by name using GameObject.Find(“GameObjectNameHere”). Primarily the names are there just for your personal benefit, and have nothing to do with whatever you name a variable in your code which references the GameObject.
Thing is I am not using code. I am using Bolt (Visual Scripting). So that means I have to pick the object from a list of them. Since that is the case does what you and Praetor are trying to say is that the underWaterObj and underWaterMesh are one in the same?