I have a script I got from the unity asset store called “Camera Path Creator” and I want to add a variable to it so I can use a dropdown menu to move the camera on the path. I can’t get the variable to show up in the inspector when I add it to the script. There was also a script called “Camera Path Inspector” That came with it. I tried adding the variable in the other script the “Camera Path Inspector” which I think is where the inspector variables are at with no luck as well. Here is the camera path creator asset Camera Path Creator | Camera | Unity Asset Store
I tried all the tricks too. I refreshed/reimport. I tried deleting and re applying the script to the camera. I declared it in a monobehaviour class. If anyone has any insight on this I would appreciate it. I tried to add my variable here in the camera path creator
public class CPC_CameraPath : MonoBehaviour
{
public Dropdown dropdown;
A custom inspector has been made for the CPC_CameraPath component, so you will have to add the variable in the CPC_CameraPath component AND add the appropriate lines in the custom inspector to display the variable.
I couldn’t find any methods with names like those you suggested or that look like they initialize variables. I did see this method I am not sure its what I need but it looks like it does something important.
void GetVariableProperties()
{
serializedObjectTarget = new SerializedObject(t);
useMainCameraProperty = serializedObjectTarget.FindProperty("useMainCamera");
selectedCameraProperty = serializedObjectTarget.FindProperty("selectedCamera");
lookAtTargetProperty = serializedObjectTarget.FindProperty("lookAtTarget");
lookAtTargetTransformProperty = serializedObjectTarget.FindProperty("target");
visualPathProperty = serializedObjectTarget.FindProperty("visual.pathColor");
visualInactivePathProperty = serializedObjectTarget.FindProperty("visual.inactivePathColor");
visualFrustumProperty = serializedObjectTarget.FindProperty("visual.frustrumColor");
visualHandleProperty = serializedObjectTarget.FindProperty("visual.handleColor");
loopedProperty = serializedObjectTarget.FindProperty("looped");
alwaysShowProperty = serializedObjectTarget.FindProperty("alwaysShow");
afterLoopProperty = serializedObjectTarget.FindProperty("afterLoop");
playOnAwakeProperty = serializedObjectTarget.FindProperty("playOnAwake");
playOnAwakeTimeProperty = serializedObjectTarget.FindProperty("playOnAwakeTime");
}
This one looks important too but I can’t find any that look like they initialize variables
public override void OnInspectorGUI()
{
serializedObjectTarget.Update();
DrawPlaybackWindow();
Rect scale = GUILayoutUtility.GetLastRect();
hasScrollBar = (Screen.width - scale.width <= 12);
GUILayout.Space(5);
GUILayout.Box("", GUILayout.Width(Screen.width - 20), GUILayout.Height(3));
GUILayout.Space(5);
DrawBasicSettings();
GUILayout.Space(5);
GUILayout.Box("", GUILayout.Width(Screen.width-20), GUILayout.Height(3));
DrawVisualDropdown();
GUILayout.Box("", GUILayout.Width(Screen.width - 20), GUILayout.Height(3));
DrawManipulationDropdown();
GUILayout.Box("", GUILayout.Width(Screen.width - 20), GUILayout.Height(3));
GUILayout.Space(10);
DrawWaypointList();
GUILayout.Space(10);
DrawRawValues();
serializedObjectTarget.ApplyModifiedProperties();
}
I would post the whole script but its like 700 lines long
That did the trick! Thank you so much!