Open rifaterdemsahin opened 6 years ago
@rifaterdemsahin here's a screenshot if you didn't understand or it didn't work, we can use TeamViewer to solve it.
Thanks for the detail. I will use this mapping and try to rename the assets accordingly if it does not work we can use TeamViewer.
This looks like a middle ground solution what do you think ? https://docs.google.com/document/d/1vk71YbTAbFkDhseLVni-8__jpG_jXLcmWQOTCzZBzH0/edit?usp=drivesdk
yeah, the package should work, I don't know how I forget about it, maybe because you told me you want a prefab.
so there is the package try it and tell how it goes.
https://drive.google.com/file/d/1E7HG6UiWbQJxhGPtgkRQj9wScH9tO1zY/view
@rifaterdemsahin
We talked on using the parts
*Prefab and scene interaction code has tobe thought out.
@dorukugur here we disabled the story and it gets enabled after this prefab enters
the prefab gets populated by other scenes we are looking for a way to use it practically over events. https://www.reddit.com/r/Unity3D/comments/9cpahl/how_to_use_prefabs_and_integrate_with_events/
would continue after resolving the issue here. Reason : prefabs not not getting used the way they should be used.( plug and plag we should not modify its content after getting it from the freelancer )
Is that What we need? @rifaterdemsahin https://drive.google.com/file/d/1H9tK1Z_7NG9PsVXV9IEh8lMGVGhrR_J5/view
this is much better than mapping
please
assigning these at start is very good ...even better than tagging and trying to match them
Using enumarations will help with the process.
blackBG = transform.GetChild (1).gameObject;
TipsImage = transform.GetChild (2).GetComponent
assigning them in here in start makes sense
and adding the delegate of the close function
Here I declared the enumerations, so it's easier to track the children objects from their names.
This is the package after we solved the mapping problem in the TipsPanel. https://drive.google.com/open?id=100SNCPOXTOYAqX7ov2oGIw6st6EyjZGo
In some versions of unity, this error will show when we drag and drop the prefab,
I searched about that error and it turns out that it's a unity bug(in some versions). this is the link: https://issuetracker.unity3d.com/issues/aspectratiofitter-modifications-dot-empty-error-after-creating-object-from-prefab-which-has-aspect-ratio-fitter-attached
but it won't affect the project, you can play the scene with no problem, and once you cleared the console it won't appear another time until you drag the prefab again.
can it be this ?
Post ReplyPrefab Value Assignments
from TaylorFowler via /r/Unity3D sent an hour ago Awake is called before start and both are called in a random order.
A good rule of thumb is to use the Awake method to setup the current objects members that don't rely on external objects being initialised. Use start for interacting with other components and getting references to objects.
For example, say you had a SetupUI class that used it's Awake method to create the game objects required by the UIManager. If the UIManager has its Awake method executed before the SetupUI component's Awake method, then you would get null references and eventually get runtime errors when you treat the null reference as a valid object.
Here's some more info: https://forum.unity.com/threads/start-vs-awake.41633/
I added this line(35), it's working clearly to close tips panel and to open menu map with SetActiveMenuMap method(line 50). So, we can use that system for all scenes. It runs prefab independently. Only close button must drag&drop to myPrefabTipCloseButton(line 25).
@rifaterdemsahin @abodaz
Also you may want to try this way
`public GameObject blackBG; //Has been set on the inspector public Image TipsImage; //Has been set on the inspector public Image FirstPost; //Has been set on the inspector public Image LastPost; //Has been set on the inspector public Button closeBTN; //Has been set on the inspector void Start() {
if (blackBG == null)
blackBG = transform.Find("BlackBG").gameObject;
if (TipsImage == null)
TipsImage = transform.Find("TipsPanel").GetComponent<Image>();
if (FirstPost == null)
FirstPost = transform.Find("FirstPost").GetComponent<Image>();
if (LastPost == null)
LastPost = transform.Find("LastPost").GetComponent<Image>();
if (closeBTN == null)
closeBTN = TipsImage.transform.Find("InsidePanel").Find("CloseBTN").GetComponent<Button>();
}`
@Neutrinora thanks for the input. Here is the reddit thread on where to assign the prefab values it focused on the awake.
Reason of using the awake
If we're not going to modify prefabs when using them, them we have no problema about losing references. We don't need to assign references on beginning, instead learning the ways how to keep references on inspector
Rules not to lose references.
never use a reference out of the box. All the fields on your prefab, must be set from self hierarcy - sun objects of the self
ıf you need a reference out of the box, like CanvasRenderer as example... Then you may use FindObjectOfType
Objects like Canvas, Camera, Eventsystem shouln not be included in prefab, they are core and mostly singleton objects. They already must be existing on the scene.
If you still want them to include in prefab, you need to know some other stuff Hard to explain here for now, at the moment i m texting from mobile
Binoys implelementation https://youtu.be/E8BlBm0kHXY
Testing task for new freelancers.
we need it a prefab Here is the sample video https://drive.google.com/file/d/1M8toFf8wGOlntqv39NkSR5H1GNaMUX7E/view?usp=sharing
Screenrecording tools Bandicam Camtasia