Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something wrong in water system #162

Open
OtakuAndFitness opened this issue Nov 29, 2021 · 1 comment
Open

Something wrong in water system #162

OtakuAndFitness opened this issue Nov 29, 2021 · 1 comment

Comments

@OtakuAndFitness
Copy link

OtakuAndFitness commented Nov 29, 2021

In WaterSurfaceDataEditor.cs,the code waveOrig.vector2Value = EditorGUI.Vector2Field(dirRect, "Point of Origin", waveOrig.vector2Value); shows error if I call it.

Mismatched types in GetValue - return value is junk
UnityEditor.SerializedProperty:get_vector2Value ()
WaterSystem.Data.WaterSurfaceDataEditor/<>c__DisplayClass1_0:<OnValidate>b__0 (UnityEngine.Rect,int,bool,bool) (at Assets/GameMain/3rdParty/com.verasl.water-system/Editor/WaterSurfaceDataEditor.cs:71)
UnityEditorInternal.ReorderableList:DoListElements (UnityEngine.Rect,UnityEngine.Rect)
UnityEditorInternal.ReorderableList:DoLayoutList ()
WaterSystem.Data.WaterSurfaceDataEditor:OnInspectorGUI () (at Assets/GameMain/3rdParty/com.verasl.water-system/Editor/WaterSurfaceDataEditor.cs:236)
WaterSystem.WaterEditor:OnInspectorGUI () (at Assets/GameMain/3rdParty/com.verasl.water-system/Editor/WaterEditor.cs:29)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Mismatched types in SetValue
UnityEditor.SerializedProperty:set_vector2Value (UnityEngine.Vector2)
WaterSystem.Data.WaterSurfaceDataEditor/<>c__DisplayClass1_0:<OnValidate>b__0 (UnityEngine.Rect,int,bool,bool) (at Assets/GameMain/3rdParty/com.verasl.water-system/Editor/WaterSurfaceDataEditor.cs:71)
UnityEditorInternal.ReorderableList:DoListElements (UnityEngine.Rect,UnityEngine.Rect)
UnityEditorInternal.ReorderableList:DoLayoutList ()
WaterSystem.Data.WaterSurfaceDataEditor:OnInspectorGUI () (at Assets/GameMain/3rdParty/com.verasl.water-system/Editor/WaterSurfaceDataEditor.cs:236)
WaterSystem.WaterEditor:OnInspectorGUI () (at Assets/GameMain/3rdParty/com.verasl.water-system/Editor/WaterEditor.cs:29)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

And even I comment it, there is nothing showing on the board if I click Customized button, Any help?

无标题

@MAyaghmay
Copy link

MAyaghmay commented Apr 15, 2022

Add this class somewhere in you codes.

public static class SerializedPropertyExtensions
{
	public static Vector2 GetFloat2AsVector(this SerializedProperty property)
	{
		Vector2 output;
		var p = property.Copy();
		p.Next(true);
		output.x = p.floatValue;
		p.Next(true);
		output.y = p.floatValue;
		return output;
	}

	public static void SetFloat2FromVector(this SerializedProperty property, Vector2 value)
	{
		var p = property.Copy();
		p.Next(true);
		p.floatValue = value.x;
		p.Next(true);
		p.floatValue = value.y;
	}
}

And then replace Vector2Field property with function from the class.
Although there is another problem with Omnidirectional wave too try not to choose that type for waves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@MAyaghmay @OtakuAndFitness and others