Hello!
To freeze my Player during conversation, I tried following the steps in this video: https://www.youtube.com/watch?v=ZxppOvE ... elCrushers
When I add the script that controls my character movement, it doesn't give me the option to disable it (please see screenshot attached).
I'm new to scripting so I'm not sure if it's something I need to modify in the script.
Thank you so much!
Cannot freeze Player during conversation
Cannot freeze Player during conversation
- Attachments
-
- PlayerComponentsScreenshot.png (69 KiB) Viewed 1098 times
Re: Cannot freeze Player during conversation
Hi,
Short answer: Assign the player GameObject that has your script on it, not the script file in your Project folder. Then you'll be able to select the character movement component's enabled property.
Long answer:
In C#, script files define classes. A class defines a set of data and the operations that can be done on the data. For example, the Unity "MonoBehaviour" class defines some data such as "enabled" and "transform".
The C# language has a feature called inheritance that lets you create new classes that extend the behavior defined in other classes. The original class is called the base class, and the class that extends it is the derived class.
Your character movement class is a derived class of the MonoBehaviour base class. Unity lets you add an instance of any class derived from MonoBehaviour to a GameObject. This instance is called a component.
Make sure to assign components, not script files, to UnityEvents in the inspector. This way Unity knows which instance of the class (e.g., on which GameObject) to work with.
Short answer: Assign the player GameObject that has your script on it, not the script file in your Project folder. Then you'll be able to select the character movement component's enabled property.
Long answer:
In C#, script files define classes. A class defines a set of data and the operations that can be done on the data. For example, the Unity "MonoBehaviour" class defines some data such as "enabled" and "transform".
The C# language has a feature called inheritance that lets you create new classes that extend the behavior defined in other classes. The original class is called the base class, and the class that extends it is the derived class.
Your character movement class is a derived class of the MonoBehaviour base class. Unity lets you add an instance of any class derived from MonoBehaviour to a GameObject. This instance is called a component.
Make sure to assign components, not script files, to UnityEvents in the inspector. This way Unity knows which instance of the class (e.g., on which GameObject) to work with.
Re: Cannot freeze Player during conversation
Thank you for your reply!
I totally didn't realize you could just drag components on the Player into that box.
I also realized that my husband had written the code in a way where it couldn't be deactivated, so I will have to work with him on that.
Thank you so much! Your explanation was very clear and helped with my understanding of how all this works. I appreciate it
I totally didn't realize you could just drag components on the Player into that box.
I also realized that my husband had written the code in a way where it couldn't be deactivated, so I will have to work with him on that.
Thank you so much! Your explanation was very clear and helped with my understanding of how all this works. I appreciate it
Re: Cannot freeze Player during conversation
Glad to help!