Closed bsimser closed 5 years ago
Original comment by KungFuBrad (Bitbucket: KungFuBrad, GitHub: KungFuBrad).
Update line 78 to:
Selection.activeObject = AssetDatabase.LoadMainAssetAtPath("Assets/MMDatabases/Items/" + target.name + ".prefab");
GameObject initialItem = PrefabUtility.InstantiatePrefab(Selection.activeObject as GameObject) as GameObject;
currentEquippable = initialItem.GetComponent
and line 117ish (serializedObject.ApplyModifiedProperties();) to:
PrefabUtility.ApplyPrefabInstance(currentEquippable.gameObject, InteractionMode.AutomatedAction);
Original comment by KungFuBrad (Bitbucket: KungFuBrad, GitHub: KungFuBrad).
So it sort of works. It does indeed add it to the appropriate parent slot but the transform isn’t correct. What I mean by that is the rotation and position and size is off.
Progress though, happy to test next version.
Original comment by KungFuBrad (Bitbucket: KungFuBrad, GitHub: KungFuBrad).
Yes please, sorry I responded to this in the Discord channel.
Thanks!
Original report by Anonymous.
Line 78ish: currentEquippable = (EquippableInventoryItem)PrefabUtility.InstantiatePrefab(t as EquippableInventoryItem);
in public class EquippableInventoryItemEditor : InventoryItemBaseEditor
returns null and doesn't allow a prefab to be created to visually equip an item.
Changing this line to: currentEquippable = Instantiate(t);
Does instantiate a prefab but clicking Save Now does not update the position. Trying to do so manually doesn't apply the transforms back appropriately.