Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
2
Question by RastaKillah · Apr 03, 2021 at 06:10 AM · gameobjectassetreferencesystemsetactive

Addressables' references - right object is there, but not!

I found another strange thing apart from my last unanswered question ( Resolution difference in same project ), I'm using addressables to lower counting between two scenes, because the editor completely freezes after loading my game scene (build version going fine). I found an answer that, if a scene has so many things in it right from the start, it could freeze in the editor, because of that many assets and loads. So I'm using addressable assets, to lower the loading capacity, and instantiate those, to get into scene. Everything is working fine, even that those assets losing references from the scene, but that's looks right, because as an asset, they can't have them from the scene.

Apart, I have an addressable, that have a reference from itself (one of it's child is that), but after I instantiate it, it's there, but I cannot do anything with it (wanted to turn off and on the gameObject). The reference looks good: it's there, if I click on it in runtime, it's showing the right object, the child object what I chosen back than as a reference saved as a public variable. But my setActive(false) command is just not working on it. My script, where I'm commanding from, is the main asset, that has that child saved as a variable. Even if I'm using this.transform.GetChild command, it's getting the right child asset that I want to turn off, but just doesn't work, no errors, not working. Apart from referencegameobject.setActive(false), I tried referencegameobject.gameObject.setActive, I tried referencegameobject.transform.gameObject.setActive, I tried as I mentioned through this.transform.GetChild.gameObject.setActive, these all always pointing right, but just doesn't work. Just for fun, I typed the same command from the script, that I'm using to instantiate addressables in runtime, and instead of finding the only one script that only my main asset has (to be correct here, I'm using FindObjectOfType on another script, not on the one where I'm instantiating these addressables, but commanding surely late enough that my script I'm looking for is there, and there's only one from it), that has the child what I want to turn off, I was using the instantiate result, and it just worked fine...... I red that the Resource system is working separately from the Addressable Assets system, or AssetBundle system, I cant remember right, but that's just a simple reference between the main object pointing to its child. Others were working fine as far as I'm testing this addressable assets system, because I have a canvas gameObject that is turning on and off one of its child through a simple but same public variable as a reference gameObject, so not as a GetChild command. That one not working as a gameObject reference, and even not if I'm using a Transform reference.

Why is this happening? If it's working on one asset, that I'm instantiating also as an addressable, same method, same command, same script, that's commanding exactly the same way (main asset commanding one of its child from reference), why not working on the other asset (the only difference is the working one is turning on the reference object, the other would turn off it)? Why there is no errors coming up? Why the editor is showing the right object that I want to command with, if I click on the reference (yellow frame in scene), but the command through the same reference, same script that has the reference, just not working?!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by RastaKillah · Apr 20, 2021 at 01:44 AM

I solved it, I did not shown any codes. I used Addressables.InstantiateAsync, but before that I had Addressables.LoadAssetAsync, was actually held Addressables, and made bad things like I typed above. So I just use Instantiate now, because I don't need any assets in the background now, what's not on scene. Learnt it, solved it .D

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image unity_9E87F4661413810E1DCD · Oct 29, 2021 at 12:37 PM 0
Share

@RastaKillah can you share the script

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

220 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to have GameObjects keep script references? 0 Answers

Reference a script on a gameobject that is disabled in scene 0 Answers

How can I get an object reference from a Raycast? 1 Answer

using System.Drawing.DLL in standalone 1 Answer

Set object reference for script at runtime 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges