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

NetworkBehaviourReference TryGet method throws error when trying to get a component that is not on the gameobject #1825

Closed
yannick-van-der-loo-fika opened this issue Mar 23, 2022 · 2 comments
Assignees
Labels
type:bug Bug Report

Comments

@yannick-van-der-loo-fika
Copy link

yannick-van-der-loo-fika commented Mar 23, 2022

I'm posting for the sake of searchability while still using Unity's bug reporting tool until it lands in the issue tracker (https://issuetracker.unity3d.com/) - I'll close it afterward.

NetworkBehaviourReference.TryGet force cast and will throw when the type is not found. It should use as to prevent throwing.
networkBehaviour = (T)GetInternal(this, null); -> networkBehaviour = GetInternal(this, null) as T;

Detailed steps to reproduce are in the official bug ticket.

Edit:
It landed on the issue tracker:
https://issuetracker.unity3d.com/issues/multiplayer-netcode-for-gameobjects-networkbehaviourreference-tryget-method-throws-error-when-trying-to-get-a-component-that-i

@yannick-van-der-loo-fika yannick-van-der-loo-fika added the stat:awaiting triage Status - Awaiting triage from the Netcode team. label Mar 23, 2022
@ashwinimurt
Copy link
Contributor

@ashwinimurt
Copy link
Contributor

Assigning to @ashwinimurt to link Jira Ticket.

@ashwinimurt ashwinimurt added stat:backlog Status - Issue could be considered for a future release. and removed stat:jira created labels Mar 29, 2022
@will-mearns will-mearns removed stat:awaiting triage Status - Awaiting triage from the Netcode team. stat:backlog Status - Issue could be considered for a future release. labels Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Bug Report
Projects
None yet
Development

No branches or pull requests

3 participants