Search Issue Tracker
Fixed in 2020.3.X
Votes
16
Found in
2020.3.24f1
2020.3.25f1
Issue ID
1390097
Regression
Yes
Specific Actions dropdown tab does not appear when setting the Target of the Touch Trigger in the LEGO Template
How to reproduce:
1. Open the user attached project
2. Enter the "LEGO Tutorial" Scene found in the Scenes folder (Assets -> LEGO -> Scenes)
3. Double click on the "Altar" Prefab GameObject in the Hierarchy
4. Press on the yellow "Touch Trigger" Prefab GameObject
5. Change the Target of the "Touch Trigger Script" Component in the Inspector to "Specific Actions"
Expected result: A modifiable dropdown tab appears
Actual result: No modifiable dropdown tab is visible
Reproducible with: 2020.3.24f1
Not reproducible with: 2019.4.34f1, 2020.3.23f1
Couldn't test with: 2021.2.7f1, 2022.1.0b2 (No LEGO Template)
Note:
- Reproducible on a new LEGO Template project
-
Schnuffelduffel
Jan 13, 2022 12:14
or direct in the line ( last word ):
from "false"
if (EditorGUILayout.PropertyField(m_SpecificTargetActionsProp, new GUIContent("Specific Actions"), false))
to "true":
if (EditorGUILayout.PropertyField(m_SpecificTargetActionsProp, new GUIContent("Specific Actions"), true))
-
Schnuffelduffel
Jan 13, 2022 12:10
The problem got solved. It is in the file “TriggerEditor.cs“
Go to C:\ user \ username \ Start Lego \ Assets \ Lego \ scripts \ Editor \
and you will find the „TriggerEditor.cs“Open the file with a Editor.
The fastest way: Delete all and copy this new in the script ( Save it and restart the tutorial after ) :
using System.Collections.Generic;
using System.IO;
using Unity.LEGO.Behaviours.Actions;
using Unity.LEGO.Behaviours.Triggers;
using Unity.LEGO.Game;
using UnityEditor;
using UnityEngine;namespace Unity.LEGO.EditorExt
{
[CustomEditor(typeof(Trigger), true)]
public abstract class TriggerEditor : LEGOBehaviourEditor
{
static readonly string editorPrefsKey = "com.unity.template.lego.showExtraConditions";static bool s_ShowExtraConditions;
protected Trigger m_Trigger;
protected SerializedProperty m_RepeatProp;
SerializedProperty m_TargetProp;
SerializedProperty m_SpecificTargetActionsProp;
SerializedProperty m_ConditionsProp;Action m_FocusedAction = null;
List<Editor> m_VariableEditors = new List<Editor>();
protected override void OnEnable()
{
base.OnEnable();m_Trigger = (Trigger)target;
m_RepeatProp = serializedObject.FindProperty("m_Repeat");
m_TargetProp = serializedObject.FindProperty("m_Target");
m_ConditionsProp = serializedObject.FindProperty("m_Conditions");
m_SpecificTargetActionsProp = serializedObject.FindProperty("m_SpecificTargetActions");s_ShowExtraConditions = EditorPrefs.GetBool(editorPrefsKey, false);
}protected void OnDisable()
{
foreach (var editor in m_VariableEditors)
{
DestroyImmediate(editor);
}m_VariableEditors.Clear();
}public override void OnSceneGUI()
{
if (Event.current.type == EventType.Repaint)
{
if (m_Trigger)
{
DrawConnections(m_Trigger, m_Trigger.GetTargetedActions(), true, Color.cyan, m_FocusedAction);
}
}
}protected void CreateTargetGUI()
{
EditorGUI.BeginDisabledGroup(EditorApplication.isPlaying);EditorGUILayout.PropertyField(m_TargetProp);
if ((Trigger.Target)m_TargetProp.enumValueIndex == Trigger.Target.SpecificActions)
{
if (EditorGUILayout.PropertyField(m_SpecificTargetActionsProp, new GUIContent("Specific Actions"), true))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_SpecificTargetActionsProp.FindPropertyRelative("Array.size"));
for (var i = 0; i < m_SpecificTargetActionsProp.arraySize; ++i)
{
GUI.SetNextControlName("Action " + i);
EditorGUILayout.PropertyField(m_SpecificTargetActionsProp.GetArrayElementAtIndex(i));
}
EditorGUI.indentLevel--;
}
}EditorGUI.EndDisabledGroup();
var previousFocusedAction = m_FocusedAction;
// Find the currently focused Action.
var focusedControlName = GUI.GetNameOfFocusedControl();
var lastSpace = focusedControlName.LastIndexOf(' ');
if (focusedControlName.StartsWith("Action") && lastSpace >= 0)
{
var index = int.Parse(focusedControlName.Substring(lastSpace + 1));
if (index < m_SpecificTargetActionsProp.arraySize)
{
m_FocusedAction = (Action)m_SpecificTargetActionsProp.GetArrayElementAtIndex(index).objectReferenceValue;
}
else
{
m_FocusedAction = null;
}
}
else
{
m_FocusedAction = null;
}if (m_FocusedAction != previousFocusedAction)
{
SceneView.RepaintAll();
}
}protected void CreateConditionsGUI(bool useFoldout = true)
{
if (useFoldout)
{
EditorGUI.BeginChangeCheck();
s_ShowExtraConditions = EditorGUILayout.Foldout(s_ShowExtraConditions, "Extra Conditions");
if (EditorGUI.EndChangeCheck())
{
EditorPrefs.SetBool(editorPrefsKey, s_ShowExtraConditions);
}
}
if (!useFoldout || s_ShowExtraConditions)
{
EditorGUI.BeginDisabledGroup(EditorApplication.isPlaying);// Refresh variable list.
var variables = GetAvailableVariables();
variables.Item2.Add("[Add New Variable]");// Show conditions.
var anyAvailableVariablesInConditions = false;
for (var i = 0; i < m_ConditionsProp.arraySize; ++i)
{
var conditionProp = m_ConditionsProp.GetArrayElementAtIndex(i);
var variableProp = conditionProp.FindPropertyRelative("Variable");
var index = variables.Item1.FindIndex(item => item == (Variable)variableProp.objectReferenceValue);index = EditorGUILayout.Popup(new GUIContent("Variable", "The variable to check."), index, variables.Item2.ToArray());
if (index > -1)
{
EditorGUILayout.PropertyField(conditionProp.FindPropertyRelative("Type"));
EditorGUILayout.PropertyField(conditionProp.FindPropertyRelative("Value"));if (index == variables.Item2.Count - 1)
{
var newVariable = CreateInstance<Variable>();
newVariable.Name = "Variable";
var newVariableAssetPath = AssetDatabase.GenerateUniqueAssetPath(Path.Combine(VariableManager.k_VariablePath, "Variable.asset"));
AssetDatabase.CreateAsset(newVariable, newVariableAssetPath);
variableProp.objectReferenceValue = newVariable;
}
else
{
variableProp.objectReferenceValue = variables.Item1[index];
}anyAvailableVariablesInConditions = true;
}GUILayout.Space(16);
}if (GUILayout.Button("Add Condition"))
{
m_ConditionsProp.arraySize++;
}if (m_ConditionsProp.arraySize > 0)
{
if (GUILayout.Button("Remove Condition"))
{
m_ConditionsProp.arraySize--;
}
}if (anyAvailableVariablesInConditions)
{
DrawSeparator();
EditorGUILayout.LabelField("Variable Settings", EditorStyles.boldLabel);
}var shownVariables = new HashSet<Variable>();
// Create and show editors for used variables.
for (var i = 0; i < m_ConditionsProp.arraySize; ++i)
{
var conditionProp = m_ConditionsProp.GetArrayElementAtIndex(i);
var variableProp = conditionProp.FindPropertyRelative("Variable");
var variable = (Variable)variableProp.objectReferenceValue;
if (variable)
{
var index = variables.Item1.FindIndex(item => item == variable);if (index > -1 && !shownVariables.Contains(variable))
{
var variableEditor = m_VariableEditors.Find(item => item.target == variable);
if (!variableEditor)
{
variableEditor = CreateEditor(variable);
m_VariableEditors.Add(variableEditor);
}if (shownVariables.Count > 0)
{
GUILayout.Space(16);
}variableEditor.OnInspectorGUI();
shownVariables.Add(variable);if (GUILayout.Button("Delete Variable"))
{
AssetDatabase.DeleteAsset(variables.Item3[index]);
}
}
}
}EditorGUI.EndDisabledGroup();
// Remove editors that represent deleted or unused variables.
for (var i = m_VariableEditors.Count - 1; i >= 0; i--)
{
var variableEditor = m_VariableEditors[i];
if (!variableEditor.target || !shownVariables.Contains((Variable)variableEditor.target))
{
DestroyImmediate(variableEditor);
m_VariableEditors.RemoveAt(i);
}
}
}
}
}
} -
Mirby77
Jan 07, 2022 21:04
same here. Please advise
-
Collierpix
Jan 05, 2022 21:17
I am having the same issue. I cannot continue without this being solved first.
-
danikasal1987
Dec 30, 2021 17:34
this is my problem now
-
paulijennifer92
Dec 30, 2021 16:30
Thank you for the important information. I am studying to become a programmer and I am very interested to learn new information from you. I have recently started writing and I recommend you to read one of my articles . I think every student has had problems with writing essays. So the materials collected in the blog will allow you to improve your grades.
-
UniBeetle
Dec 27, 2021 21:30
I see the same issue in version 2020.3.25f1.1418
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Prefab override popup is cropped/positioned incorrectly when more than one display is used and a higher display Scale is set
- Opening a dropdown on a small screen results in its instant closing when mouse cursor is pressed where the dropdown is going to be opened
- Only "ArgumentNullException: Value cannot be null" is displayed instead of all the actual errors when opening a project with numerous compilation errors
- MultiColumnListView and MultiColumnTreeView do not change selection on first input when focus is set by code
- SerializedProperty.DataEquals is returning false when SerializedProperty.EqualContents return true
Resolution Note (fix version 2020.3):
Fixed in: LEGO® Microgame v2.4.2