Hi,
I'm trying to make a change to a member variable default value without modifying existing code. I like to keep the Opsive code the same as long as I can so that I don't have to merge the changes every time I get Opsive update.
For instance, I would like to change a default value in ShooterWeapon.cs something other than the followings.
Obviously, I'll need to inherit the class and I try to hide the member variable with a different default value.
If I do, I get an error like,
The culprit is having the [SerializedField] in both classes.
If I remove [SerializeField] attribute from MyShooterWeapon, the default value won't change from the base when I first initialize the class.
I guess this is more like a Unity question but I would appreciate if you can help how it can be done.
Thanks a lot!
I'm trying to make a change to a member variable default value without modifying existing code. I like to keep the Opsive code the same as long as I can so that I don't have to merge the changes every time I get Opsive update.
For instance, I would like to change a default value in ShooterWeapon.cs something other than the followings.
Code:
[SerializeField] protected MinMaxVector3 m_ShellVelocity = new MinMaxVector3(new Vector3(3, 0, 0), new Vector3(4, 2, 0));
Obviously, I'll need to inherit the class and I try to hide the member variable with a different default value.
Code:
public class MyShooterWeapon : ShooterWeapon
{
[SerializeField] protected new MinMaxVector3 m_ShellVelocity = new MinMaxVector3(new Vector3(0, -3, 0), new Vector3(0, -4, 2));
}
If I do, I get an error like,
The same field name is serialized multiple times in the class or its parent class. This is not supported: Base(MyShoorterWeapon) m_ShellVelocity
The culprit is having the [SerializedField] in both classes.
If I remove [SerializeField] attribute from MyShooterWeapon, the default value won't change from the base when I first initialize the class.
I guess this is more like a Unity question but I would appreciate if you can help how it can be done.
Thanks a lot!