Skip to content

fix(#133): Fix item spawner & items#135

Merged
PatrykPaluch merged 4 commits intomainfrom
fix/133/items-temp-fix
Mar 24, 2026
Merged

fix(#133): Fix item spawner & items#135
PatrykPaluch merged 4 commits intomainfrom
fix/133/items-temp-fix

Conversation

@Acu1000
Copy link
Copy Markdown
Collaborator

@Acu1000 Acu1000 commented Mar 19, 2026

closes #133

@Acu1000 Acu1000 requested review from PatrykPaluch and Xori7 March 19, 2026 17:26
Shader shader = itemInfo?.Icon == null
? Shader.Find("Hidden/InternalErrorShader")
: Shader.Find("Universal Render Pipeline/Unlit");
if (material) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverse if to avoid nested code:
if (!material) return;

Comment on lines +60 to +65
ItemComponent itemComponent = gameObject.AddComponent<ItemComponent>();
itemComponent.Init(new ItemInstance(itemInfo, itemData));
Destroy(this);
Destroy(GetComponent<MeshRenderer>());
Destroy(GetComponent<MeshFilter>());
transform.localScale = Vector3.one;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code should run in build too:

void OnEnable() 
{
  #if UNITY_EDITOR
  ReInitImage();
  #endif
  if (Application.isPlaying) 
  {
    // code
  }
}

@Acu1000 Acu1000 requested a review from PatrykPaluch March 21, 2026 22:32
@PatrykPaluch PatrykPaluch merged commit 822fbdc into main Mar 24, 2026
2 checks passed
@PatrykPaluch PatrykPaluch deleted the fix/133/items-temp-fix branch March 24, 2026 15:13
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

Successfully merging this pull request may close these issues.

Fix item spawner & items

2 participants